summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 c4b181970..b6f4d6d2c 100644
--- a/builtin/common/strict.lua
+++ b/builtin/common/strict.lua
@@ -11,7 +11,7 @@ end
local meta = {}
local declared = {}
-
+local alreadywarned = {}
function meta:__newindex(name, value)
local info = debug.getinfo(2, "Sl")
@@ -36,9 +36,10 @@ end
function meta:__index(name)
local info = debug.getinfo(2, "Sl")
- if not declared[name] and info.what ~= "C" then
+ if not declared[name] and info.what ~= "C" and not alreadywarned[name] then
warn(("Undeclared global variable %q accessed at %s:%s")
:format(name, info.short_src, info.currentline))
+ alreadywarned[name] = true
end
return rawget(self, name)
end