[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Protecting global variables
- From: Peter Slížik <peter.slizik@...>
- Date: Sat, 18 Aug 2012 20:38:30 +0200
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