lua-users home
lua-l archive

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


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);