So I guess I'm a bit lost here my friend and I started working on game and our progress has been halted due to the lack of understanding of how threads work aperently. So if someone could please take the time and explain what I did wrong that would be rad.
Goal: We would like to have the server run when you hit the host server button and that would also double as single player where you could disable/enable player joining like minecraft kinda.
Problem: The problem that we are having is that the thread that the server should run on won't stay running and just stops.
Curent Progress: This is how I thought threads worked but this does not work how I thought it would, it runs the server file once and if you put the thread:start in love.update well then it just keeps restarting the server like expcted.
This is also not a problem with the app as the server part does work fine if you start it as its own app. This is just me not understanding the thread part and yes I did look at older posts to try and find something helpful before posting but I didn't see any thing that was able to help with this problem.
The main thread that's started by default when you run a löve project goes through a few internal functions, and then arrives at a function called love.run; that includes some init code, a call to love.load, and then an infinite loop that polls events, calls love.update, love.draw, love.present and sleeps the thread (which matters more when vsync is turned off, but it happens in both cases)
In short, löve already gave you an infinite loop, the "game loop", as part of love.run in the main thread, but you're lacking such a thing when you create another thread without such code.
You need to define a loop (not necessarily infinite, could work in many ways, but at least a counting for loop shouldn't be used; repeat-until, while-do-end can work) and check for termination conditions and other things inside it; if you want it to work at a set speed, i'd suggest you put a love.timer.sleep in there as well, 0.001 is fine for the parameter, and you can just use love.timer.getTime in the thread (i think) and accumulate dt yourselves, and by that, everything's similar to what you can do in the main thread (with the exception that graphics functions can't be called from any thread other than the main one, and there are a few other functions that are not thread-safe or can't be called from other threads, not just in love.graphics or love.window)
You also need to require love.* if you want to use those modules inside a thread (with the exception of love.filesystem and love.thread, iirc); the above restrictions withstanding.
If by any chance you do have a loop, then you might have gotten an error, you need to catch those with love.threaderror, i think.
Me and my stuff True 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.