SendServerData: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
desc=This will send data( results in calling onClientScriptData of squirrel-server )| | desc=This will send data( results in calling onClientScriptData of squirrel-server )| | ||
params=<syntaxhighlight lang="lua">(data)</syntaxhighlight> | params=<syntaxhighlight lang="lua">(data)</syntaxhighlight> | ||
<poem>::data: | <poem>::data: A blob which is written with one or more of [[WriteByte]], [[WriteInt]], [[WriteFloat]] and [[WriteString]]. | ||
</poem>| | |||
example= | example= | ||
<source lang="lua"> | <source lang="lua"> | ||
local b=blob(); | local b=blob(); | ||
WriteInt(b, 1000); | |||
WriteByte(b, 100); | |||
WriteFloat(b, 356.456); | |||
b | WriteString(b, "Hello"); | ||
b | |||
b | |||
SendServerData(b); | SendServerData(b); | ||
</source> | </source>| | ||
retvals=true on success, false on failure( instead of blob, some other instance of a class is passed )| | |||
relfuncs=*[[onServerData]] | |||
relfuncs=*[[ | |||
}} | }} |
Latest revision as of 05:39, 3 February 2023
This function was added in v1.6 beta and will not work on previous versions.
Description:
This will send data( results in calling onClientScriptData of squirrel-server )
Parameters:
(data)
data: A blob which is written with one or more of WriteByte, WriteInt, WriteFloat and WriteString.
Return Values:
true on success, false on failure( instead of blob, some other instance of a class is passed )
Example
local b=blob(); WriteInt(b, 1000); WriteByte(b, 100); WriteFloat(b, 356.456); WriteString(b, "Hello"); SendServerData(b);
Related Functions
The following functions may be helpful as they relate to this function in one way or another.