summaryrefslogtreecommitdiff
path: root/builtin/common/strict.lua
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
committerShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
commitcaecdb681c428c1aab9c0f7eec2570c0460f995c (patch)
treee5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /builtin/common/strict.lua
parent81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff)
parent80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff)
downloadminetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'builtin/common/strict.lua')
-rw-r--r--builtin/common/strict.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/common/strict.lua b/builtin/common/strict.lua
index 23ba3d727..ccde9676b 100644
--- a/builtin/common/strict.lua
+++ b/builtin/common/strict.lua
@@ -3,6 +3,7 @@
-- This ignores mod namespaces (variables with the same name as the current mod).
local WARN_INIT = false
+local getinfo = debug.getinfo
function core.global_exists(name)
if type(name) ~= "string" then
@@ -18,7 +19,7 @@ local declared = {}
local warned = {}
function meta:__newindex(name, value)
- local info = debug.getinfo(2, "Sl")
+ local info = getinfo(2, "Sl")
local desc = ("%s:%d"):format(info.short_src, info.currentline)
if not declared[name] then
local warn_key = ("%s\0%d\0%s"):format(info.source,
@@ -42,7 +43,7 @@ end
function meta:__index(name)
- local info = debug.getinfo(2, "Sl")
+ local info = getinfo(2, "Sl")
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
if not declared[name] and not warned[warn_key] and info.what ~= "C" then
core.log("warning", ("Undeclared global variable %q accessed at %s:%s")