lua-users home
lua-l archive

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


ret = {getBones()} 

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Christophe
Delépine
Sent: terça-feira, 12 de junho de 2007 12:58
To: lua@bazar2.conectiva.com.br
Subject: Variable number of return values from C to lua

Hello,

I have a C function that returns a variable number of values to a LUA
function :

int getBones(lua_State* l)
{
    for (int i=0; i<bonesOut.getSize(); i++)
    {
        lua_pushnumber(l, (int)bonesOut[i]);
    }

    return bonesOut.getSize();
}

The LUA function does not know the number of values that are returned How
can i get the values and store them in a simple LUA table ?


Thanks