Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.