Results 1 to 10 of 10

Thread: Question about lnet :)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Ah, OnRe is a procedure.... Hmm. I thought it was just a variable and that it was one of those times where the @ trick didn't work for the memory address and thus a pointer to it as a variable type might however that usually doesn't work with a procedure.

    The problem, after looking at the code, is that you are trying to set the variable FCon.OnRecieve to a procedure - which cannot be done. The example is correct in saying that IF FCon.Onrecieve is of type procedure you could tell it the memory address of the procedure with the @.

    Ignoring all of the above, whats the error message the compiler gives exactly? My suggestion coming from a pure FPC perspective would be to do

    Code:
    if FCon.OnRecieve then OnRe;
    However this assumes that FCon.OnRecieve is of type Boolean and that, as the code indicates, OnRe is a procedure. However, this is from a FPC perspective as my lazarus knowledge is very limited.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #2
    Yes OnRe is a procedure so it doesn't return any value. Here is the code for FCon.OnReceive:

    property OnReceive: TLSocketEvent read FOnReceive write FOnReceive;

    I'm not sure how properties work so that's probably why I'm stumped on this


    When I compile with the code being:

    FCon.OnReceive := @OnRe;

    It says: Variable identifier expected.

    I really appreciate your help Code_Glitch, I hope we can sort this issue out because I'm this ->||<- close to having multiplayer for my game

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    I read this page: http://wiki.freepascal.org/User_Chan...regular_fields

    My understanding from it is that the 'property' maps onto a variable of some type and that it can be used as a sort of splitter. Ie: The property can be read and it will read from a value and the property can be written to in which case it can write to another value. I only had a skim so I'm not sure how it could apply. I'll think it over and hopefully come up with a solution later this evening - hungry as ever so unable to work on it much right now
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  4. #4

  5. #5
    Fixed it just forgot to do FCon.Callaction;

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •