|
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)
{printf("construct %d items in stack\n",stack_size);
int stack_size = lua_gettop(L);
lua_pushinteger(L,stack_size);
return 1;
}
...
lua_register(L, "construct", construct);