Browse Source

Improve error handling in network module by suppressing Lua's error message when loading the socket module. This change enhances the user experience by preventing unnecessary error output while maintaining fallback functionality.

main
Bastian (BaM) 3 months ago
parent
commit
8b9c855912
  1. 2
      scripts/network.lua

2
scripts/network.lua

@ -6,10 +6,10 @@ local utils = require("utils")
-- Try to load socket module, fallback to basic implementation for LuaJIT -- Try to load socket module, fallback to basic implementation for LuaJIT
local socket local socket
local socket_available = true local socket_available = true
-- Try to load socket module, ignore Lua's error message
local ok, err = pcall(function() socket = require("socket") end) local ok, err = pcall(function() socket = require("socket") end)
if not ok then if not ok then
print("Warning: socket module not available, using fallback implementation") print("Warning: socket module not available, using fallback implementation")
print("Error:", err)
socket_available = false socket_available = false
-- Create a minimal socket fallback for LuaJIT -- Create a minimal socket fallback for LuaJIT
socket = { socket = {

Loading…
Cancel
Save