Bf read.Reset

From GMod Wiki

Jump to: navigation, search
Function
Syntax bf_read:Reset( )
Description:
Resets the "read head" to the beginning of the message (so you can re-read parts of the message if necessary).
Returns: nil
In Object: Bf_read
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Bf read.Reset]Bf read.Reset [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionReads string "You", then reads string ", Me, ", resets the overhead and reads the first string again. Prints the whole output to console
Used onNewerClient.png
Code
 
local function ReadStrings(msg)
   local str1 = msg:ReadString()
   local str2 = msg:ReadString()
   msg:Reset() -- resets the overhead so we are able to read the from the start
   msg:ReadString() -- move past the unique string id and read the data present in the message subsequently
   local str3 = msg:ReadString()
   print(str1..str2..str3)
end
usermessage.Hook("SendStrings", ReadStrings)
 
Output"You, Me, You" is printed to console


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox