[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is it possible to send var-args (...) to a native function?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 7 Feb 2011 17:05:20 -0200
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);