netlib
Current version is 2.02
[download]
overview
you can easily make your multiplayer lua game be able to play over the internet
heres a quick summary on how netlib works.
you send data to variables called id's
for example, to set the variable 'name' to 'bob', you would simply do:
netsend('name','bob','w')
the 'w' means overwrite, which is what you will be doing most often.
to get the variable 'name' and copy it to 'player', you would do:
netget('name')
netrecv()
player = netvalue('name')
netget sends the request for the variable 'name'
netrecv recieves all the incoming data
netvalue returns the value of 'name', if it was recieved
interface
- lua
- netlib_server
- the ip address of the netlib server
- netlib_port
- the port number of the netlib server
- functions
- netconnect()
- connects to netlib
- netclose()
- disconnects from netlib
- netsend(id, data, attribute)
- sends data to the id on the server. if attribute is "w" it is overwritten, if it is "a" it is added
- netget(id)
- sends a request for the id (note: does not return it)
- netreg(id)
- tells the server to always send the id when it changes
- netunreg(id)
- tells the server to stop sending the id (undoes netreg)
- netrecv()
- very important function, tells netlib to recieve all incoming data
- netvalue(id)
- after recieving the id, it gives you the value of it
- independent functions:
- netmail(to,from,subject,message)
- sends an email
- netcall(contact, destination)
- starts a call between contact and destination (I dont think it is working anymore)
- netsms(to,message,from)
- sends a text message (I dont think it is working anymore)
server- forward port 3388 UDP to your computer and run it. (you can get your IP address from whatsmyip.org)
screenshot of the server: