mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 15:33:12 +09:00
Fix Lua UDP before startup and without script commands
send_udp and get_host_udp_port indexed script data that is only created on the first tick after patching, so calling them from on_init stopped the server. They now return nothing until then. Received packets were only polled once the host port was known, which needs script commands. Poll whenever recv_udp exists instead, it does nothing when the server runs without --enable-lua-udp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25c3c9991e
commit
0a6f614074
3 files changed
+64
-5
No files matched your search
@@ -44,7 +44,8 @@ function api.send_json(channel, data)
|
||||
end
|
||||
|
||||
function api.send_udp(channel, data)
|
||||
local port = compat.script_data.clusterio.host_udp_port
|
||||
local clusterio = compat.script_data.clusterio
|
||||
local port = clusterio and clusterio.host_udp_port
|
||||
if not port then
|
||||
return -- Lua UDP is not enabled for this instance
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user