Page 1 of 1

Making a custom build of LÖVE that can be run on CLI?

Posted: Wed Dec 20, 2017 1:27 pm
by Substance12
I'm developing a multiplayer game and I want to know if it's possible to build a version of LÖVE that doesn't show any window, allowing it to be run in a command line. I would need to do this to run the servers, as I'd rather not have to port all of my game to plain Lua and figure out a new way to use dt (unless there's an easier way to work around this). Is it even possible? I have some knowledge of C++ so I think I could do it myself

Re: Making a custom build of LÖVE that can be run on CLI?

Posted: Wed Dec 20, 2017 2:43 pm
by zorg
You don't need to make a different build.
Wiki article: Config_Files

Code: Select all

t.console = true
t.window = false
t.modules.window = false
t.modules.graphics = false
:3

One more thing, you'll need to know that io.read blocks, so if you want to have code run simultaneously while also accepting commands from the console window, you'll need to put the console io functions into another thread.

Re: Making a custom build of LÖVE that can be run on CLI?

Posted: Wed Dec 20, 2017 3:35 pm
by Substance12
Damn, I feel dumb now :o: glad to hear it's so easy though, thanks a lot! And I don't think I'll use io.read, but I'll keep that in mind.

Re: Making a custom build of LÖVE that can be run on CLI?

Posted: Wed Dec 20, 2017 5:34 pm
by zorg
Substance12 wrote: Wed Dec 20, 2017 3:35 pm Damn, I feel dumb now :o: glad to hear it's so easy though, thanks a lot! And I don't think I'll use io.read, but I'll keep that in mind.
You're welcome, and just to be clear, i meant that if you want to get input from the CLI, i believe lua io's the only way, and whichever function you use, it will block the thread the function was called from. That said, if you don't plan to allow input from the console, then it's a moot point.

Re: Making a custom build of LÖVE that can be run on CLI?

Posted: Wed Dec 20, 2017 6:21 pm
by Nixola
You can also use LuaSocket if you want to get input from the CLI without blocking. It's a hack at best though, and you should really use threads if you can.