GNet object targets

BlitzMax Forums/BlitzMax Programming/GNet object targets

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You use a method that wraps all the internal data to a formated string that you parse out again with the "from" method.

Something like:

Type GNetAttachedObject
  field x:int, y:int
  field name:string

  method ToString(obj:TGNetObject,slot:int)
    local str:string = x + ";"+ y + ";" + name
    setgnetstring(obj,slot,str)
  end method
    
  method FromString(obj:TGnetObject, slot:int)
    local str:string = getgnetstring(obj,slot)
    x = int(left(str,instr(";")))
    str = right(str, len(str)-instr(";"))
    y = int(left(str,instr(";")))
    name = right(str,len(str)-instr(";"))
  end method
end type


*not guaranteed to work as I can't test right now*