diff options
author | Lua Team <team@lua.org> | 2007-03-25 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2007-03-25 12:00:00 +0000 |
commit | cf61d326a6adbeb4ea9467af3fe4da1af8784f01 (patch) | |
tree | 49df3771ebb97aa16a40d2e96a67e2368f11f1e6 /etc | |
parent | 7e7bc7c7c7f3301a5f837579b81bcac4a2f9cccc (diff) | |
download | lua-github-cf61d326a6adbeb4ea9467af3fe4da1af8784f01.tar.gz |
Lua 5.1.2-rc25.1.2-rc2
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) |