lua-users home
lua-l archive

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


On Tue, Nov 13, 2012 at 4:57 PM, Rena <hyperhacker@gmail.com> wrote:
> Another advantage would be for
> multiple libraries to use separate userdata types, each with their own
> metatables.

That's not needed for userdata, and lightuserdata can't have
metatables in the first place.

> Or you could have a "float" type, if you're working with a
> program that doesn't understand doubles.

If you're using LuaJIT, this is already supported. If you're using
vanilla Lua, your binding code is already taking care of this and the
Lua code doesn't need to care.

> Or any type of data you need to
> manipulate quickly, as long as it fits within 8 bytes, you can avoid the
> memory management overhead.

Sounds like a solution without a problem. You can't manipulate this
from inside Lua without adding functionality in C anyway, so you
aren't gaining all that much. And again, if you're THAT worried about
performance, you're using LuaJIT.

/s/ Adam