現在、Luabindを使用してLuaスクリプトAIをC++ゲームとインターフェースする際に問題が発生しています。
ループ内で更新関数を呼び出し(フレームごとに1回)、この関数はLuabindに登録されているC++関数から情報を取得します。
私の問題は次のとおりです。変動する予測不可能な時間が経過した後、Luabindでアサーションが失敗し、アサーションが発生します。Lua内を下降している間、エラーは常に/usr/include/luabind/wrapper_base.hpp:124で発生します。
あなたはそれを何ができるかについて何か考えがありますか?私のテストでは、C++とLUAで呼び出される関数は常に同じです。
問題の詳細:
wrapper_base.hppで失敗したアサーション周辺のコンテンツ
typedef typename boost::mpl::if_<boost::is_void<R>, luabind::detail::proxy_member_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
, luabind::detail::proxy_member_caller<R, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
// Comments removed
lua_State* L = m_self.state();
m_self.get(L);
assert(!lua_isnil(L, -1));
detail::do_call_member_selection(L, name);
if (lua_isnil(L, -1))
{
lua_pop(L, 1);
throw std::runtime_error("Attempt to call nonexistent function");
}
// push the self reference as the first parameter
m_self.get(L);
// now the function and self objects
// are on the stack. These will both
// be popped by pcall
return proxy_type(L, args);
正確なエラー
bomberman: /usr/include/luabind/wrapper_base.hpp:124: typename boost::mpl::if_<boost::is_void<T>, luabind::detail::proxy_member_void_caller<boost::tuples::tuple<boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >, luabind::detail::proxy_member_caller<R, boost::tuples::tuple<boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >::type luabind::wrap_base::call(const char*, luabind::detail::type_<Derived>*) const [with R = void]:
Assertion `!(lua_type(L, (-1)) == 0)' failed.
Aborted (core dumped)