Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
NicholasScott1337 edited this page Jul 18, 2015 · 2 revisions

Net:send( table, cmd, param, id )


Description
Call-Only
The entirety of the library, running this will send a table to the server OR client with a command to run and parameters
Parameters
Table
Table you want to send across the network, this can contain anything EXCEPT other tables!!!!
CMD
The command you want to run on the other end, string, IE. "print", "update", "sync" etc.
Param
Parameters you want to go with the command, this can be useful for things like "killPlayer" you can supply the players id/name in the parameters, rather than in the table as an extra variable
ID
This is a server side parameters, this is the id of the client you want to send to, Nil out on client side issuing
Returns

Nil

Formats

Nil

Examples

Registers a command server side for clients to run, then runs it from a client

--Server
Net:registerCMD( "KillMe", function( table, param, id, dt )
   killUser( id )
end )
--Client
local table = {}
Net:send( table, "KillMe", Nil ) -- This will kill them

Registers a command client side for the server to run, then runs it from a server

--Client ID:"31.224.116.12:10057"
Net:registerCMD( "print", function( table, param, dt )
   print( "Server: "..param )
end )
--Server
local table = {}
Net:send( table, "print", "Hello", "31.224.116.12:10057" ) -- This prints to their console "Hello"