Skip to content

Commit aeb59c1

Browse files
committed
fix: load LuaSocket/socket.lua from base VFS in LuaMenu (fixes lobby networking)
CLuaMenu::InitLuaSocket looked for 'socket.lua' in the default VFS, which never resolved, so the menu/lobby's LuaSocket never initialised and Chobby logged 'Error loading socket.lua' and could not connect to multiplayer servers. socket.lua actually ships in springcontent.sdz at LuaSocket/socket.lua; load it from SPRING_VFS_BASE with a FileExists guard, matching CLuaUI::InitLuaSocket.
1 parent 66c40e1 commit aeb59c1

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

rts/Lua/LuaMenu.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,18 @@ string CLuaMenu::LoadFile(const string& name) const
137137
void CLuaMenu::InitLuaSocket(lua_State* L) {
138138
RECOIL_DETAILED_TRACY_ZONE;
139139
std::string code;
140-
std::string filename = "socket.lua";
141-
CFileHandler f(filename);
140+
// socket.lua ships in springcontent.sdz under LuaSocket/; load it from
141+
// the base VFS exactly as CLuaUI::InitLuaSocket does. The previous path
142+
// ("socket.lua", default VFS) never resolved, so the menu/lobby's
143+
// LuaSocket support failed to initialise ("Error loading socket.lua"),
144+
// breaking multiplayer server connections from Chobby.
145+
std::string filename = "LuaSocket/socket.lua";
146+
CFileHandler f(filename, SPRING_VFS_BASE);
147+
148+
if (!f.FileExists()) {
149+
LOG_L(L_ERROR, "Error loading %s (file does not exist)", filename.c_str());
150+
return;
151+
}
142152

143153
LUA_OPEN_LIB(L, luaopen_socket_core);
144154

0 commit comments

Comments
 (0)