lua-users home
lua-l archive

Re: Protecting global variables

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


To add one more answer to my own question: I've gotten back to
Programming in Lua. In Chapter 14, section "Global-Variable
Declarations", Roberto writes:
""" Because Lua keeps its global variables in a regular table, we can
use metatables to change its behavior when accessing global
variables."
This is followed by an example setting a new metatable with defined
__newindex to the _G environment.
>From this I infer it should be also safe with regards to the standard libraries.
I'm posting this just for future reference, if somebody happens to
find this thread via Google.
Peter

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