mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Remove unused variable WARN_INIT
This commit is contained in:
parent
f10a260301
commit
6f0c966877
@ -1,8 +1,3 @@
|
|||||||
|
|
||||||
-- Always warn when creating a global variable, even outside of a function.
|
|
||||||
-- This ignores mod namespaces (variables with the same name as the current mod).
|
|
||||||
local WARN_INIT = false
|
|
||||||
|
|
||||||
local getinfo = debug.getinfo
|
local getinfo = debug.getinfo
|
||||||
|
|
||||||
function core.global_exists(name)
|
function core.global_exists(name)
|
||||||
@ -33,11 +28,6 @@ function meta:__newindex(name, value)
|
|||||||
end
|
end
|
||||||
declared[name] = true
|
declared[name] = true
|
||||||
end
|
end
|
||||||
-- Ignore mod namespaces
|
|
||||||
if WARN_INIT and name ~= core.get_current_modname() then
|
|
||||||
core.log("warning", ("Global variable %q created at %s.")
|
|
||||||
:format(name, desc))
|
|
||||||
end
|
|
||||||
rawset(self, name, value)
|
rawset(self, name, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -54,4 +44,3 @@ function meta:__index(name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
setmetatable(_G, meta)
|
setmetatable(_G, meta)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user