Update LuaStack.cpp

This commit is contained in:
Deal 2023-08-11 23:51:15 +08:00 committed by GitHub
parent b228718022
commit c359bea0dd
1 changed files with 2 additions and 2 deletions

View File

@ -627,7 +627,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State* L)
{ {
std::string code; std::string code;
ResizableBufferAdapter<std::string> adapter(&code); ResizableBufferAdapter<std::string> adapter(&code);
if (zip->getFileData(filename.c_str(), &adapter) && !code.empty()) if (zip->getFileData(filename, &adapter) && !code.empty())
{ {
// remove .lua or .luac extension // remove .lua or .luac extension
size_t pos = filename.find_last_of('.'); size_t pos = filename.find_last_of('.');
@ -649,7 +649,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State* L)
} }
} }
AXLOG("[luaLoadChunksFromZIP] add %s to preload", filename.c_str()); AXLOG("[luaLoadChunksFromZIP] add %s to preload", filename.c_str());
if (stack->luaLoadBuffer(L, (char*)code.c_str(), (int)code.size(), filename.c_str()) == 0) if (stack->luaLoadBuffer(L, code.data(), static_cast<int>(code.size()), filename.c_str()) == 0)
{ {
lua_setfield(L, -2, filename.c_str()); lua_setfield(L, -2, filename.c_str());
++count; ++count;