bahrmichael / factorio-tycoon

GNU General Public License v3.0
10 stars 7 forks source link

chore: simplify construction event handlers + few functions #308

Closed winex closed 7 months ago

winex commented 8 months ago

don't squash, please. best to be merged after #307 is in

this is picked from destroy event fix #300, which depends on it

bahrmichael commented 7 months ago

@winex I added serpent to the luacheckrc. You can pull the latest updates to make the build green :)

winex commented 7 months ago

@bahrmichael rebased, coding speedrun is green now :)

winex commented 7 months ago

Would it be possible to avoid goto statements? I'm not aware if there's anything requiring those, and prefer if/else statements over jumps across the code.

yep, changed. goto's aren't my preference as well, but sometimes it simplifies cleanup code paths to just few lines... that's why i used it here - it just states that you never forget one last thing(s).

though, as Lua doesn't have continue statement (lol) i still use close-jump gotos sometimes in loops to minimize if-then nesting

bahrmichael commented 7 months ago

though, as Lua doesn't have continue statement (lol) i still use close-jump gotos sometimes in loops to minimize if-then nesting

I agree that this is a bit annoying, and would continue to avoid gotos. Sometimes extracting code into another function was a good workaround for me.