diff options
Diffstat (limited to 'etc')
-rw-r--r-- | etc/lua.pc | 2 | ||||
-rw-r--r-- | etc/strict.lua | 9 |
2 files changed, 8 insertions, 3 deletions
@@ -5,7 +5,7 @@ # grep '^V=' ../Makefile V= 5.1 # grep '^R=' ../Makefile -R= 5.1.1 +R= 5.1.2 # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' prefix= /usr/local diff --git a/etc/strict.lua b/etc/strict.lua index 7c9fa159..16ee26b4 100644 --- a/etc/strict.lua +++ b/etc/strict.lua @@ -14,9 +14,14 @@ end mt.__declared = {} +local function what () + local d = debug.getinfo(3, "S") + return d and d.what or "C" +end + mt.__newindex = function (t, n, v) if not mt.__declared[n] then - local w = debug.getinfo(2, "S").what + local w = what() if w ~= "main" and w ~= "C" then error("assign to undeclared variable '"..n.."'", 2) end @@ -26,7 +31,7 @@ mt.__newindex = function (t, n, v) end mt.__index = function (t, n) - if not mt.__declared[n] and debug.getinfo(2, "S").what ~= "C" then + if not mt.__declared[n] and what() ~= "C" then error("variable '"..n.."' is not declared", 2) end return rawget(t, n) |