すべて。luabindを使用してluaスクリプトから配列を読み取ると、奇妙な問題が発生しました。
luaスクリプトは次のようになります。
root =
{
id = 1,
id = 2,
id = 3
};
c++コードは次のようになります。luabind::objectdata_root = luabind :: globals(L)["root"];
for (luabind::iterator i(data_root), end; i != end; ++i)
{
luabind::object data = *i;
unsigned int id = luabind::object_cast<unsigned int>(data);
std::cout << "id:" << id << std::endl;
}
出力は次のとおりです。
id:3
[root]のすべての要素を出力したいのですが、最後の1つ以上しか出力しません。
ありがとう、ジェイソン:)