テーブル内テーブルへのアクセス

luaスクリプト

test={3,4,5,test2={10,11}}

test.test2テーブルにアクセスする

	//グローバル配列へのアクセス
	lua_getglobal(L, "test");

	printf("pop%3d\n",lua_gettop(L));
	lua_pushstring(L, "test2");
	lua_gettable(L, -2);
	lua_pushnil(L);
	printf("%3d\n",lua_gettop(L));
	while(lua_next(L ,-2) != 0)
	{
		printf("%3d\n",lua_gettop(L));
		printf("%s - %s - %s\n",
			lua_typename(L, lua_type(L, -3)), 
			lua_typename(L, lua_type(L, -2)), 
			lua_typename(L, lua_type(L, -1)));
		printf("%f - %f\n",
			 lua_tonumber(L,-2),lua_tonumber(L,-1));
		lua_pop(L, 1);
	}