aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/testLua/yueliang-0.4.1/test_lua/5.0/undefined.lua
blob: efe5f2459e8a8487ae36fbc33289677613e88d5a (plain)
1
2
3
4
5
6
7
8
9
-- catch "undefined" global variables

local f=function (t,i) error("undefined global variable `"..i.."'",2) end
setmetatable(getfenv(),{__index=f})

-- an example
a=1
c=3
print(a,b,c)	-- `b' is undefined