[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LuaX enums (Re: really fast metatable lookup in C)
- From: Asko Kauppi <asko.kauppi@...>
- Date: Sun, 19 Dec 2004 16:46:53 +0200
Thanks for answering, Adrian. :)
I had considered using upvalues (currently limited to 60, see
MAXUPVALUES in luaconf.h), but your email made me revise that approach,
and it works. Partially.
Any enums pushed by metamethods themselves (s.a. concatenation,
addition for int32's and so forth) should now be better; they use an
upvalue for the table reference. However, I cannot extend this
approach to whatever API functions that would push such values. This,
imho, is still acceptable, and most importantly, the system is simple
for the application code to handle. I'm pleased.
There's still some debugging and intertwined issues (s.a. Lua libraries
not really supporting the float mode) but these will be sorted out. I
really look forward to having an "int32" enabled LuaX release within a
month or so.
-ak
18.12.2004 kello 16:01, Adrian Sietsma kirjoitti:
Asko Kauppi wrote:
Based on the enum/int32 implementation for Lua, I'm in the need for
an extremely fast integer -> metatable lookup on the C side.
Currently, I use 'glua_meta_nn' keys into the registry, but there
must be a better way.
Could I, say, have a set of some 1000 :) virtual indices s.a.
'REGISTRYINDEX' all for my own need. I could maintain that range by
myself (store table references there, in neat order) as long as it
would be sure no-one else is dealing with those 'slots'.
Does Lua already provide this, or could such a range be considered
for the future?
-ak
if you are on the c-side, could you use upvalues ?
(push them all at lib init time maybe ?)
is there a limit to the number of upvalues allowed ?
Adrian