[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: metatables for strings?
- From: Nagaev Boris <bnagaev@...>
- Date: Sun, 3 May 2015 16:46:36 +0000
On Sun, May 3, 2015 at 4:39 PM, Dirk Laurie <email@example.com> wrote:
>> PS 2. Why no individual metatables for light userdata?
> They would no longer be light. A light userdata is like a number:
> it's just a pointer.
Light userdata's advantage over normal userdata is being a number in
context of table's key. In other words two light userdata pointing the
same memory (sharing the same address) are *one* key in a table.
Normal userdata with values of pointers are two keys in a table. The
only workaround I know is using table, mapping light userdata to
normal userdata with same value.