lua-users home
lua-l archive

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


Thank you for the answer lhf, but I am using Lua 4.1w4. Shouldn't I somehow
use the metatable to set the settable tag method on 'this'?

Matt

----- Original Message -----
From: "Luiz Henrique de Figueiredo" <lhf@tecgraf.puc-rio.br>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Wednesday, April 24, 2002 2:44 PM
Subject: Re: Protecting variables


> >What I want to know is, is there a way to protect those variables so that
> >they cannot be reset by a user. For instance, I do not want them to be
able
> >to do this:
> >
> >this = {} or this.TestMethod = function() end
>
> Yes, give a tag to "this" with settag+newtag and set "setglobal" and
"settable"
> tag methods for it.
>
> >Also, when invoking a C method that is a member of a table with the ':'
> >operator, is 'self' still passed as the first argument? Or is that only
> >passed to table functions written in Lua?
>
> It's passed to both kinds of functions. Lua handles C functions
transparently.
> --lhf
>