multi/multi/trigger.lua
Ryan 86db39ae7f Fixed a bug in the trigger module
It would return 2 self references upon connection instead of 1
2017-06-09 14:16:39 -04:00

18 lines
311 B
Lua

require("multi")
function multi:newTrigger(func)
local c={}
c.Type='trigger'
c.trigfunc=func or function() end
function c:Fire(...)
self:trigfunc(...)
end
function c:tofile(path)
local m=bin.new()
m:addBlock(self.Type)
m:addBlock(self.trigfunc)
m:tofile(path)
end
self:create(c)
return c
end