[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: re: "Locking" global variables?
- From: Dark God <darkgod@...>
- Date: Wed, 6 Aug 2003 19:40:27 +0200
On Wed, 6 Aug 2003 12:00:11 -0300 (BRT)
lua-request@bazar2.conectiva.com.br wrote:
> Gang,
> Is there a way in Lua to lock a global variable after initializing it so
> that trying to reassign it will fail?
>
> We'd like to prevent inadvertent reassignment of key global variables by
> some unaware scriptor...
You change the setglobal tag to a function that throws an error(in lua4, in lua5 it must be a field of the metatable but the idea stays)