[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Read only variables
- From: "Chris Percival" <cpercival@...>
- Date: Thu, 31 Jan 2002 09:12:13 -0000
Wonderful, thankyou.. That should give me something to work with..
Chris Percival
Software Engineer
Interaxis Computing Ltd.
DDI: +44 (0)1249 700072
http://www.interaxis.co.uk/
> -----Original Message-----
> From: owner-lua-l@tecgraf.puc-rio.br
> [mailto:owner-lua-l@tecgraf.puc-rio.br]On Behalf Of Peter Shook
> Sent: 31 January 2002 05:02
> To: Multiple recipients of list
> Subject: Re: Read only variables
>
>
> aircooledspeed wrote:
> >
> > If I create a variable using (for example):
> >
> > lua_pushstring(L, "Hello world");
> > lua_setglobal(L, "MyHelloString");
> >
> > Is there any way to make that variable read only (or 'constant') in
> > the script, ie any attempt to change their value results in an error?
>
> You can make the value a userdata, and use the setglobal tag method to
> protect it. But this only works for globals. It won't work on local
> variables.
<snip>