lua-users home
lua-l archive

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


Hi,

I have a Lua function which returns a table with the results of the 
function and would like to check if all results are really set and no 
dict entries are missing, after calling this function from C.
I know that the result table should have five dictionary entries if
everything went fine.

Is there a more elegant way or a more Lua like solution to figure out 
if my function returned everything I expect than counting the pairs in
the following way:
     int count = 0;
     lua_pushnil(L);
     while (lua_next(L, t) != 0) {
       count++;
       lua_pop(L, 1);
     }
     if (count < 5) /* do something ... */
Thanks,
Regards,

Jörg