lua-users home
lua-l archive

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


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

> t2 = const {'a','b'}
…
> t2[#t2+1]='x' would result in creating a NEW table with contains all the old elements plus a new one. The old table remains unchanged; it is immutable.

Should not `t2[anything]` generate "Attempt to assign to an immutable table"?