summaryrefslogtreecommitdiffhomepage
path: root/not/Trigger.lua
blob: c6ef7c7afb2b72c91841a7bd0becc29ef3c68f01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Trigger = require "not.Object":extends()

function Trigger:new ()
	self.calls = {}
end

function Trigger:register (func, ...)
	local call = {func = func, params = {...}}
	table.insert(self.calls, call)
end

function Trigger:emit ()
	for _,call in pairs(self.calls) do
		call.func(unpack(call.params))
	end
end

return Trigger