[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Son of Lua - Sol
- From: "Russell Y. Webb" <rw20@...>
- Date: Wed, 31 Jan 2001 08:25:24 -0800
Making all globals read-only by default seemed like a good solution to me.
Then 'global x' gives you write access to the global.
Of course you can have a 'local' key word which then switches off write
access to a global.
> From: Reuben Thomas <email@example.com>
> Reply-To: firstname.lastname@example.org
> Date: Wed, 31 Jan 2001 10:22:19 +0000 (GMT)
> To: Multiple recipients of list <email@example.com>
> Subject: Re: Son of Lua - Sol
>> The main thing I did was to make a 'global' keyword and make Lua default to
>> creating locals inside a function, of course read access to globals was
>> still there by default (in one version just for global functions):
>> b = 10
>> c = 1
>> function test(x)
>> global c;
>> b = "this does not change the global";
>> c = "but this does";
>> print(10); -- this uses the read access to globals
> I was wondering about doing this the other day; this is the sort of thing
> I'd love to see too.
> I'd not thought of the problem that you really want global functions to be
> implicitly available, but not global variables, but of course there's no
> difference between them in Lua (it's the type of the contents of the
> variable, not that of the variable itself). Nasty...
> http://sc3d.org/rrt/ | Caution Children At Play Drive Slowly