【问题标题】:Crash when calling luabind function on object在对象上调用 luabind 函数时崩溃
【发布时间】:2013-12-25 09:21:44
【问题描述】:

当我尝试从 C++(通过 luabind)运行“运行”函数(在 lua 中定义)时,我收到以下错误:

Game_Launcher.exe 中 0x767BC41F 处的未处理异常:Microsoft C++ 异常:内存位置 0x001BF8B8 处的 luabind::error。

使用一些 try/catch 技巧,我得到了一些没用的消息:

表达式:lua 运行时错误

表达式:运行

卢阿:

local function Run(self)
    self.ticks = self.ticks + 1
end

return {
    ticks = 0,
    Run = Run,
}

C++:

void ScriptComponent::Initialize()
{
    // I pipe everything through a filesystem, so the script must be loaded as a string first
    String fileData;
    fileSystem->LoadFromFile("myscript.lua", filedata);

    int err = lual_loadstring(L, fileData);
    luabind::object compiledScript(luabind::from_stack(L, -1));
    lua_pop(luaState, 1);
    luabind::object luaDataTable = compiledScript();
    lua_pop(luaState, 1);

    // Execute the run function
    luaDataTable["Run"](luaDataTable);
}

据我所知,luaDataTable 是一个表格并且是有效的。不知道我做错了什么!

【问题讨论】:

    标签: c++ lua luabind


    【解决方案1】:

    如果我删除它工作的第一个弹出状态,我会出现,哎呀!

    【讨论】:

      猜你喜欢
      • 2013-01-28
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 1970-01-01
      • 1970-01-01
      • 2021-11-27
      • 1970-01-01
      • 2013-11-11
      相关资源
      最近更新 更多