Refine cocos2dx_lua_loader logic

This commit is contained in:
halx99 2021-11-16 14:12:32 +08:00
parent f7128789a0
commit eb5dcb6cfc
1 changed files with 2 additions and 4 deletions

View File

@ -108,15 +108,13 @@ extern "C"
{ {
LuaStack* stack = LuaEngine::getInstance()->getLuaStack(); LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
resolvedPath.insert(resolvedPath.begin(), '@'); // lua standard, add file chunck mark '@' resolvedPath.insert(resolvedPath.begin(), '@'); // lua standard, add file chunck mark '@'
stack->luaLoadBuffer(L, reinterpret_cast<const char*>(chunk.getBytes()), static_cast<int>(chunk.getSize()), return stack->luaLoadBuffer(L, reinterpret_cast<const char*>(chunk.getBytes()), static_cast<int>(chunk.getSize()),
resolvedPath.c_str()); resolvedPath.c_str());
} }
else else
{ {
CCLOG("can not get file data of %s", resolvedPath.c_str()); CCLOG("can not get file data of %s", resolvedPath.c_str());
return 0; return LUA_ERRFILE;
} }
return 1;
} }
} }