lua-users home
lua-l archive

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

On 25 April 2018 at 05:06, Dirk Laurie <> wrote:
> 2018-04-25 0:20 GMT+02:00 Bruce Hill <>:
>> Hey everybody, I just released a library that allows you to create immutable
>> tables in Lua. The tables are stored compactly and instances are interned
>> (but garbage collected), so the immutable tables can be used as table keys.
>> I know there's been a lot of talk lately about "arrays with holes", and my
>> library supports that.
> How does your library compare with pure-Lua read-only tables?

This works:

T[tuple("foo", "bar")] = 123
assert(T[tuple("foo", "bar")] == T[tuple("foo", "bar")])


This doesn't:

T[readonly{"foo", "bar"}] = 123
assert(T[readonly{"foo", "bar"}] == T[readonly{"foo", "bar"}])

-- Hisham