Code: Select all
function call(c)
udp:send(c)
local val = udp:receive()
return val
end
Code: Select all
function call(c)
udp:send(c)
local val = udp:receive()
return val
end
Code: Select all
function call(c)
udp:send(c)
local ok, val = pcall(udp.receive, udp)
if ok then
return val
end
return nil, val
end
Is it possible to do it async here? Maybe launching a second thread: https://love2d.org/wiki/love.threaddr.flimflam9 wrote: ↑Fri Oct 18, 2024 7:34 pm when i turn on timeout the window just crashes, not errors. I want to make it so that the program will only proceed after receiving the response without the game crashing.
I don't understand. Then again why turn on timeout? By default receive() will block indefinitely until it receives something, according to the docs.dr.flimflam9 wrote: ↑Fri Oct 18, 2024 7:34 pm when i turn on timeout the window just crashes, not errors. I want to make it so that the program will only proceed after receiving the response without the game crashing.
I know, but then the game doesn't respond and crashes. the usage of settimeout is just so i remember it is enabled, even if it is by default.pgimeno wrote: ↑Fri Oct 18, 2024 8:20 pmI don't understand. Then again why turn on timeout? By default receive() will block indefinitely until it receives something, according to the docs.dr.flimflam9 wrote: ↑Fri Oct 18, 2024 7:34 pm when i turn on timeout the window just crashes, not errors. I want to make it so that the program will only proceed after receiving the response without the game crashing.
dr.flimflam9 wrote: ↑Fri Oct 18, 2024 10:58 am Is there a way to make love not crash while waiting, but just freeze?
From what pgimeno read in the docs, even if the request timed out, it should return the pair (nil, "timeout"), not outright crash back to the desktop.I want to make it so that the program will only proceed after receiving the response without the game crashing.
Users browsing this forum: No registered users and 4 guests