*Lua 數據類型
table={
{1,2,3},
{"1","2","3"},
}
C API 遍歷table
lua_getglobal(L, t);//獲取lua table
lua_pushnil(L);//壓入nil 作爲KEY
while (lua_next(L, -2)) {//
//多維table -1 table ,-2 key
lua_pushnil(L);//壓入nil 作爲KEY
while (lua_next(L, -2)) {//
//內層數組
/* 此時棧上 -1 處爲 value, -2 處爲 key */
lua_tostring(-1);
lua_pop(L, 1);//從棧中彈出 當前元素 讓 table 在棧頂
}
lua_pop(L, 1);//從棧中彈出 當前元素 讓 table 在棧頂
}
lua_pop(L, 1);//清空棧