1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-10 19:32:10 +00:00

unset debug.getinfo

This commit is contained in:
Desour 2025-03-25 13:45:22 +01:00
parent a2f98b1879
commit 5a422ca0c6
7 changed files with 22 additions and 10 deletions

View file

@ -1,5 +1,6 @@
local builtin_shared = ...
local S = core.get_translator("__builtin")
local debug_getinfo = debug.getinfo
--
-- Make raw registration functions inaccessible to anyone except this file
@ -548,7 +549,7 @@ function core.registered_on_player_hpchange(player, hp_change, reason)
local func = core.registered_on_player_hpchanges.modifiers[i]
hp_change, last = func(player, hp_change, reason)
if type(hp_change) ~= "number" then
local debuginfo = debug.getinfo(func)
local debuginfo = debug_getinfo(func)
error("The register_on_hp_changes function has to return a number at " ..
debuginfo.short_src .. " line " .. debuginfo.linedefined)
end
@ -570,7 +571,7 @@ function core.register_on_player_hpchange(func, modifier)
end
core.callback_origins[func] = {
mod = core.get_current_modname() or "??",
name = debug.getinfo(1, "n").name or "??"
name = debug_getinfo(1, "n").name or "??"
}
end