lua-users home
lua-l archive

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

> 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
> end

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...

-- | Caution Children At Play Drive Slowly