lua错误信息

int _tmain(int argc, _TCHAR* argv[])
{
    Test::Tst_B* b = new Test::Tst_B;         // instance used in Lua code

    lua_State* L = lua_open();
    luaL_openlibs(L);
    tolua_tclass_open(L);

    int top = lua_gettop(L);

    int loaderr = luaL_loadfile(L,"tclass.lua");
    if (loaderr)
    {
        const char* errMsg = lua_tostring(L,-1);
        lua_settop(L,top);
#ifdef _DEBUG
        ::printf_s("[LuaScriptModule]: %s\n", errMsg);
#endif
    }

    // call it
    if (lua_pcall(L,0,0,0))
    {
        const char* errMsg = lua_tostring(L,-1);
        lua_settop(L,top);
#ifdef _DEBUG
        ::printf_s("[LuaScriptModule]: %s\n", errMsg);
#endif
    }

    lua_settop(L,top); // just in case :P

    lua_close(L);

    delete b;
    return 0;
}


阅读更多
文章标签: lua delete
个人分类: LUA
上一篇简单C++调用lua函数及C++和lua相互函数调用小例子
下一篇跳跃表(Skip List)
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭