lua-users home
lua-l archive

Re: local variables and scope

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


On Aug 25, 2005, at 15:18, Roberto Ierusalimschy wrote:
Follows a nice script to detect missing "local" declarations and other
"wrong" uses of global variables.
Simply put it in your path and add require"strict" to your program
(or call "lua -lstrict").
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:
lua -w Test.lua
lua: attempt to access undefined variable '_NAME'
stack traceback:
 [C]: ?
 [C]: in function 'module'
 .../socket.lua:14: in main chunk
 [C]: in function 'require'
 Test.lua:10: in main chunk
 [C]: ?
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/

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