lua-users home
lua-l archive

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


I apologize, I just verified with a simpler function in my program that it is possible.  I'll have to check my more complicated problem for the bug.  Thanks!

On Mon, Feb 7, 2011 at 2:05 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
Try the code below and then compare to your own.

-- in Lua:
print(construct(10,20,30,40))

-- in C:

static int construct(lua_State* L)
{
       int stack_size = lua_gettop(L);
       printf("construct %d items in stack\n",stack_size);
       lua_pushinteger(L,stack_size);
       return 1;
}
...
       lua_register(L, "construct", construct);