lua-users home
lua-l archive

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


You could use metamethods to implement a read-only table, by implementing
the 'index' metamethod.

As far as i know it is not possible to restrict variable assignment, but I'm
not sure if there are some special cases or some new aspects in Lua 5.

----- Original Message ----- 
From: "Javier Gonzalez" <Xavier_Gonzalez@lycos.es>
To: <lua@bazar2.conectiva.com.br>
Sent: Tuesday, May 20, 2003 9:04 PM
Subject: Adding some restrictions to users


> Hello, I have a doubt.
> In lua5, how could I do so:
> x = y
> is disallowed, being x any variable and y a C function
>
> Also, how could I make a table "say protected" to be read only? (no way to
> modify/create/delete indexes)
>
> Thanks in advance
>