mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
compat stubs: fix warnings on death-reload
This commit is contained in:
parent
98c6b716d7
commit
9251278e46
1 changed files with 7 additions and 1 deletions
|
@ -3,6 +3,11 @@
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
|
|
||||||
local warnLog = (isDeveloperKeys() and errorLog) or debugLog
|
local warnLog = (isDeveloperKeys() and errorLog) or debugLog
|
||||||
|
local STUBS = rawget(_G, ".._compat_util_stubs")
|
||||||
|
if not STUBS then
|
||||||
|
STUBS = {}
|
||||||
|
rawset(_G, ".._compat_util_stubs", STUBS)
|
||||||
|
end
|
||||||
|
|
||||||
-- generate function that warns when called and returns nil
|
-- generate function that warns when called and returns nil
|
||||||
local function warndummy(name)
|
local function warndummy(name)
|
||||||
|
@ -34,11 +39,12 @@ end
|
||||||
|
|
||||||
local function makestubs(tab, gen)
|
local function makestubs(tab, gen)
|
||||||
for name, param in pairs(tab) do
|
for name, param in pairs(tab) do
|
||||||
if rawget(_G, name) then
|
if not STUBS[name] and rawget(_G, name) then
|
||||||
errorLog("WARNING: oldfunctions.lua: function " .. name .. " already exists")
|
errorLog("WARNING: oldfunctions.lua: function " .. name .. " already exists")
|
||||||
else
|
else
|
||||||
local f = gen(name, param)
|
local f = gen(name, param)
|
||||||
rawset(_G, name, f)
|
rawset(_G, name, f)
|
||||||
|
STUBS[name] = f
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue