Skip to content

Instantly share code, notes, and snippets.

@Elmuti
Created May 20, 2015 18:37
Show Gist options
  • Save Elmuti/a300b358b04618b63efb to your computer and use it in GitHub Desktop.
Save Elmuti/a300b358b04618b63efb to your computer and use it in GitHub Desktop.
local Signal = {}
local mobj = require("ModObject")
function Signal.New()
local sig = Signal:Init()
sig.connection = nil
return sig
end
function Signal:Connect(f)
self.connection = f
end
function Signal:Fire(...)
if self.connection ~= nil then
self.connection(...)
end
end
local SignalClass = mobj:NewClass("Signal", nil, Signal)
return SignalClass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment