diff options
Diffstat (limited to 'builtin/game/register.lua')
-rw-r--r-- | builtin/game/register.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/builtin/game/register.lua b/builtin/game/register.lua index 56e40c75c..0be107c36 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -403,8 +403,14 @@ function core.override_item(name, redefinition) register_item_raw(item) end - -core.callback_origins = {} +do + local default = {mod = "??", name = "??"} + core.callback_origins = setmetatable({}, { + __index = function() + return default + end + }) +end function core.run_callbacks(callbacks, mode, ...) assert(type(callbacks) == "table") @@ -419,9 +425,7 @@ function core.run_callbacks(callbacks, mode, ...) local ret = nil for i = 1, cb_len do local origin = core.callback_origins[callbacks[i]] - if origin then - core.set_last_run_mod(origin.mod) - end + core.set_last_run_mod(origin.mod) local cb_ret = callbacks[i](...) if mode == 0 and i == 1 then |