lua-enet only sending some messages

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
mxmlnbndsmnn
Prole
Posts: 37
Joined: Mon Feb 11, 2019 4:17 pm

Re: lua-enet only sending some messages

Post by mxmlnbndsmnn »

zorg wrote: Thu Aug 05, 2021 2:22 pm effectively, i think you're discarding every other event (since, you know, the loop repeats and you lose an event by getting one both at the start and the end...)

Get rid of that last "event = self.host:service()" line from both client and server and test it out.
You're the hero! This is exactly where it went wrong. Thanks bunches ;)

In hindsight this double event = ... was suspicious from the start. However, I started from this tutorial: https://love2d.org/wiki/lua-enet and there the event is fetched twice. BUT only now I see that they used a while loop in this tutorial, while I used a repeat loop... (facepalm)
But you know, this happens. I guess :c
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: lua-enet only sending some messages

Post by zorg »

yeah, for some reason, the "example code" does an initial service call with a sizeable timeout; it's not actually part of a loop (since the outer infinite loop is actually akin to löve's own "game loop"... kinda? the event loop only calls it at the end, but it's fine if it's done in the beginning... i actually do prefer that version myself as well, what i suggested.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], zorg and 6 guests