[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: protecting exported data from within C
- From: "Mark Swinson" <mswinson@...>
- Date: Wed, 16 Mar 2005 01:30:16 -0000
I want to export some data into the script space, and prevent the user from
modifying it from within their script.
For example I exported the following simple test data
( C code not included )
Account.version = 1.0;
The following C code snippet makes the above readonly -
int readonly(lua_State* L)
luaL_error(L,"error: read only table");
/* __newindex = readonly */
However, I find I can still modify the value of Account.version. I only get
the error message
if I try and add new fields to the table. From the description in the book
my function should
be called whenever lua tries to assign something to the table.
Any reason why this should be so.