mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
3f8be3151a
* Add redmew_surface * Change map_layout to have all maps use redmew_surface * Maps: switch hardcoded nauvis refs to redmew_surface * Features: switch hardcoded nauvis refs to redmew_surface * Per discussion, removal of RSO * Changes to files based on linting warnings/errors * ent_functions: remove functions from global scope, ignore remaining linting warnings (~100 remaining) * borg_planet: ignore linting warnings (88 remaining) * mazes refactored * Changed global.lua so events are run in the order they are registered
34 lines
629 B
Lua
34 lines
629 B
Lua
local Event = require 'utils.event_core'
|
|
local Token = require 'utils.token'
|
|
|
|
local Global = {}
|
|
|
|
function Global.register(tbl, callback)
|
|
local token = Token.register_global(tbl)
|
|
|
|
Event.on_load(
|
|
function()
|
|
callback(Token.get_global(token))
|
|
end
|
|
)
|
|
end
|
|
|
|
function Global.register_init(tbl, init_handler, callback)
|
|
local token = Token.register_global(tbl)
|
|
|
|
Event.on_init(
|
|
function()
|
|
init_handler(tbl)
|
|
callback(tbl)
|
|
end
|
|
)
|
|
|
|
Event.on_load(
|
|
function()
|
|
callback(Token.get_global(token))
|
|
end
|
|
)
|
|
end
|
|
|
|
return Global
|