C API、lua_gettop()
/* * $ gcc -Wall -W -o 2008092900 -llua50 2008092900.c */ #include <stdio.h> #include <lua50/lua.h> int main(void) { lua_State *L; L = lua_open(); printf("%d\n", lua_gettop(L)); lua_pushvalue(L, 1); printf("%d\n", lua_gettop(L)); lua_pushvalue(L, 2); printf("%d\n", lua_gettop(L)); lua_close(L); return 0; }
で、
0 1 2