在栈顶的就是参数个数
static int lua_call_server_method(lua_State* L) { int argc = lua_gettop(L); const char* method_name = luaL_checkstring(L, 1); for(int i = 2 ; i <= argc ; i++ ){ int type = lua_type(L, i); switch(type){ case LUA_TTABLE: break; case LUA_TSTRING: break; case LUA_TNUMBER: break; } printf("%d\n", type); } return 1; }
原文地址:http://blog.csdn.net/frodo_sens/article/details/45914693