mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Merge branch 'develop' of https://github.com/grilledham/RedMew into tag-group-refactor
This commit is contained in:
commit
415bbb3006
24
utils/global.lua
Normal file
24
utils/global.lua
Normal file
@ -0,0 +1,24 @@
|
||||
local Event = require 'utils.event'
|
||||
local Token = require 'utils.global_token'
|
||||
|
||||
Global = {}
|
||||
|
||||
local data = {}
|
||||
|
||||
function Global.register(tbl, callback)
|
||||
local token = Token.register_global(tbl)
|
||||
table.insert(data, {tbl = tbl, callback = callback, token = token})
|
||||
end
|
||||
|
||||
Event.on_load(
|
||||
function()
|
||||
for _, d in ipairs(data) do
|
||||
local tbl = Token.get_global(d.token)
|
||||
d.callback(tbl)
|
||||
end
|
||||
|
||||
data = nil
|
||||
end
|
||||
)
|
||||
|
||||
return Global
|
Loading…
Reference in New Issue
Block a user