lua.wetgenes.spew
local spew=require("wetgenes.spew").connect(oven.tasks)
You must pass in a previously created tasks object that you will be calling update on regually so that our coroutines can run. eg oven.tasks
Connect and talk to the wetgenes spew server using wetgenes.tasks task for meta state and a thread for lowlevel sockets.
You push messages in and can pull messages out or, setup a hook function to auto pull and process messages in our coroutine as they are received.
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.