[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Return a variable number of values from function
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 19 Nov 2001 10:32:21 -0200
>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