Created
May 24, 2015 14:38
-
-
Save Elmuti/4c8d2bf23cb9e6f3e27d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Signal = {} | |
local mobj = require("System/Libraries/ModObject") | |
function Signal.New() | |
local sig = Signal:Init() | |
sig.connection = nil | |
return sig | |
end | |
function Signal:Connect(f) | |
self.connection = f | |
end | |
function Signal:Disconnect() | |
self.connection = nil | |
end | |
function Signal:Fire(...) | |
if self.connection ~= nil then | |
self.connection(...) | |
end | |
end | |
return mobj:NewClass("Signal", nil, Signal) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment