ReadInt: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
(Created page with "local a= ReadInt(data); {{Welcome|desc=This will read an integer(4 bytes) from the given blob obtained from onServerData.|params=<source lang="lua">( data )</source><poem> ::data : The blob obtained from onServerData </poem>| example=<source lang="lua"> function OnServerData( data ) { local a= ReadInt(data); print("I received " + a + " from server\n"); } </source>| retvals=The function returns the integer on success. On failure throw error.| relfuncs=*Rea...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
local a= ReadInt(data);
{{Welcome|desc=This will read an integer(4 bytes) from the given blob obtained from [[onServerData]].|params=<source lang="lua">( data )</source><poem>
{{Welcome|desc=This will read an integer(4 bytes) from the given blob obtained from [[onServerData]].|params=<source lang="lua">( data )</source><poem>
::data : The blob obtained from [[onServerData]]
::data : The blob obtained from [[onServerData]]
Line 7: Line 5:
function OnServerData( data )
function OnServerData( data )
{
{
local a= ReadInt(data);
    local a = ReadInt(data);
     print("I received " + a + " from server\n");
     print("I received " + a + " from server\n");
}
}
Line 15: Line 13:
*[[ReadFloat]]
*[[ReadFloat]]
*[[ReadString]]
*[[ReadString]]
*[[SendServerData]]}}
*[[OnServerData]]}}

Latest revision as of 17:45, 24 June 2023


Description:
This will read an integer(4 bytes) from the given blob obtained from onServerData.


Parameters:

( data )

data : The blob obtained from onServerData


Return Values:
The function returns the integer on success. On failure throw error.


Example

function OnServerData( data )
{
    local a = ReadInt(data);
    print("I received " + a + " from server\n");
}

Related Functions

The following functions may be helpful as they relate to this function in one way or another.