lua-users home
lua-l archive

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

On Fri, Dec 31, 2010 at 18:07, Gaspard Bucher <> wrote:
> I understand your point. I am not saying a table in Lua is this or that and
> I agree that it I have to use an arbitrary rule. I am currently using "no
> value in array" means hash:

> if (lua_objlen(L, index) > 0)
>   pack_as_array(L, index);
> else
>   pack_as_hash(L, index);

This would not work. This table layout is a common idiom:

  gamma = "delta";

> 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;

That bad?

I'm not familiar with msgpack or zeroMQ, but this may (or may not) be helpful: