Skip to content

Built in Functions

Ligustah edited this page Mar 18, 2011 · 4 revisions

connect(host, port)

This will establish a connection to the specified host and port.
Upon success onConnect will be called.

send(packet...)

Send one or more packets to the server currently connected to.

local login = Login("Miney", "Password")
send(Handshake("Miney"), login)

setTimer(interval, callback)

Add a callback to be called at a given interval. Interval is in milli seconds. No guarantee is made as to how precise the interval is.

The callback can be any callable type. If the callback returns a value that is considered true (see toBool in the StdLib) the timer is stopped.

Returns the ID used for this timer.

local id = setTimer(1000, function()
{
	writeln $ "This would run once a second!"
	writeln $ "But it will stop itself :O"
	return true
})

stopTimer(ID)

Stop a timer given an ID.

Clone this wiki locally