lua-users home
lua-l archive

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


2011/4/22 Axel Kittenberger <axkibe@gmail.com>:
>
> While I do share the worries not to make every table slower, all it
> needs would be a bit flag for a table "has used indices" for its meta
> or "hasn't". And quering one bit really is close to nothing compared
> to the whole fluff of a table access. As far as I remember, there is
> an now in 5.2 there is an unused bit in the tables bitmasks..
>

Also, in 5.2, userdata seems to have such a flagging for the __gc
metamethod: if you give a metatable which doesn't contain __gc to a
userdata, then add __gc afterwards, Lua will behave as if __gc wasn't
there (5.2 alpha, §2.5.1). It doesn't seem to be the  case in 5.1
though, since the doc doesn't mention it (§2.10.1). Therefore, doing
the same with tables and __index wouldn't be totally unacceptable :-).


-- 
Benoit.