lua-users home
lua-l archive

Re: local variables and scope

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> This is very handy, as well as the related 'lua -w' flag.
> 
> That said, if you have the misfortune to require a module, you are 
> toasted:
We may assume C knows what it is doing, so strict.lua should be like this:
 mt.__index = function (t, n)
- if not mt.__declared[n] then
+ if not mt.__declared[n] and debug.getinfo(2, "S").what ~= "C" then
 error("variable '"..n.."' is not declared", 2)
 end
 return rawget(t, n)
Probably we will remove the -w flag in favor of -lstrict.
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /