lua-users home
lua-l archive

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


>So, I tried this with a C function, which is registered properly. It pushes
>some random values and returns the number of values (lua_pushnumber(MyState,
>iRandomNumber); ... return iNumOfNumbers;). Using getn on the result of this
>function leads to a LUA_ERRRUN. Any suggestions?

If you're returning the values by themselves, not inside a table, then
your code should be right (lua_pushnumber, lua_pushnumber, ... return n)
In this case, you cannot use getn because no table is returned.

If you're using a table, then you should return 1 not n, because the table is
the only return value.
--lhf