[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Psuedo-proposal: const expression
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 9 Mar 2012 15:57:53 +0200
>> > const t1 = {'a','b'}
>>
>> With current Lua syntax, it is possible to write a function
>> "const" so that
>> t1={'a','b'}; const"t1"
>> does what you want.
>
> Would that make t1 immutable so it always refers to the same table? My Lua knowledge hasn't got that far yet.
>
No. `t1` is the same as `_ENV.t1` .
It would add t1 to _ENV's list of immutable names, starting a new
list if none such exists and modifying _ENV's table writing access
to check for immutability.