lua-users home
lua-l archive

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


On Sun, May 3, 2015 at 12:39 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2015-05-03 18:33 GMT+02:00 Nagaev Boris <bnagaev@gmail.com>:
>
>> PS. I still like syntax "hello":sub(1, 4)
> Didn't somebody make a patch to allow that?
>
>> 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.
>

You can "fake" individual metatables for light userdata, by keeping a
reference to each userdata in a weak table, and looking up their
individual methods in that table. Only trouble is it requires all code
using light userdata in your application to cooperate.

-- 
Sent from my Game Boy.