I am also wondering if there is a faster method to get the hash size (needed to prepare the map):
for(lua_pushnil(L); lua_next(L, index) != 0; lua_pop(L, 1)) ++sz;
G.
On Fri, Dec 31, 2010 at 3:53 PM, Drake Wilson
<drake@begriffli.ch> wrote:
Quoth Gaspard Bucher <gaspard@teti.ch>, on 2010-12-31 15:21:43 +0100:
> What is the "official" way to determine if a table has a hash (in C) ?
No, no, no, nonononono.
No.
You don't.
A table is a table. A table is not exactly an array or a hash. The
fact that there are array-esque and hashtable-esque parts underneath
is irrelevant to the actual semantics of tables. It is not part of
the interface.
If you want to make any semantic distinctions, you have to do it
yourself by defining some predicate on the set of keys in the table,
such as "tables with only contiguous positive integer keys starting
from 1 are treated as list-like". Then you implement the predicate
yourself however you please (usually by iterating the keys and testing
for properties of the whole set).
---> Drake Wilson