lua.wetgenes.spew.connect
local spew=require("wetgenes.spew").connect(oven.tasks)
local spew=require("wetgenes.spew").connect(oven.tasks,host)
local spew=require("wetgenes.spew").connect(oven.tasks,host,port)
You must pass in an active tasks object.
Create task and thread connection to the host. host and port default to wetgenes.com and 5223 so can be left blank unless you want to connect to a local host for debugging.
There are now 3 ways to handle msgs
spew.push(msg)
To send a msg
local msg,s=spew.pull()
To receive a message, will return nil if no messages available. The second return value is the input string packet for this decoded message.
spew.hook=function(msg,s) print(msg) end
Set a hook functions to auto pull all available messages durring tasks update. Note that if you do this spew.pull() will no longer work as all messages are auto pulled and sent to this hook function.
Note when receiving a msg you must not alter or cache the table you are given as it is internal data and is reused. You must duplicate it if you want to keep it arround.