From eb5dcb6cfcbe1aee2ccfe0deba09fb0414737835 Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 16 Nov 2021 14:12:32 +0800 Subject: [PATCH] Refine cocos2dx_lua_loader logic --- .../scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extensions/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp b/extensions/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp index e0c9910a29..2a7db54e2a 100644 --- a/extensions/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp +++ b/extensions/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp @@ -108,15 +108,13 @@ extern "C" { LuaStack* stack = LuaEngine::getInstance()->getLuaStack(); resolvedPath.insert(resolvedPath.begin(), '@'); // lua standard, add file chunck mark '@' - stack->luaLoadBuffer(L, reinterpret_cast(chunk.getBytes()), static_cast(chunk.getSize()), + return stack->luaLoadBuffer(L, reinterpret_cast(chunk.getBytes()), static_cast(chunk.getSize()), resolvedPath.c_str()); } else { CCLOG("can not get file data of %s", resolvedPath.c_str()); - return 0; + return LUA_ERRFILE; } - - return 1; } }