[SOLVED] Multiple conf.lua files?
Posted: Wed Dec 26, 2012 11:27 am
Hi,
I am still working on my game which has a (headless) server and a client side application. Currently, I have the Server and the client in two different folders using different sets scripts. However, lots of functions on the server and on the client are the same and I don't want to keep on changing them for both, each time I make an update to one of them. That's one of the reasons why I want to merge the two.
My Problem is that the server needs to run headless and thus needs to be called with a different conf.lua file, so its main file needs to be in a different folder than the main file of the client.
I tried to make two folders called Server and Client and put the main.lua files and corresponding conf.lua files in there.
Here's the setup:
This gives me multiple problems:
I CAN include the scripts using
package.path = "../Scripts/?.lua;" .. package.path
However, I CANNOT add the images in the same way. love.graphics.newImage just won't find them
package.path = "../Images/?.png;" .. package.path
Also, when I distribute my game, this won't work as a .love file.
What I'd rather have is a way to change the conf.lua file depending on the command line arguments. But I cannot find a way to do this, since conf.lua runs _before_ I ever get to the arguments in love.load.
Any ideas?
love.graphics module must be disabled on the server at startup... otherwise I'll get errors and it won't run on my webserver.
I am still working on my game which has a (headless) server and a client side application. Currently, I have the Server and the client in two different folders using different sets scripts. However, lots of functions on the server and on the client are the same and I don't want to keep on changing them for both, each time I make an update to one of them. That's one of the reasons why I want to merge the two.
My Problem is that the server needs to run headless and thus needs to be called with a different conf.lua file, so its main file needs to be in a different folder than the main file of the client.
I tried to make two folders called Server and Client and put the main.lua files and corresponding conf.lua files in there.
Here's the setup:
Code: Select all
- Client
- main.lua
- conf.lua
- Server
- main.lua
- conf.lua
- Scripts (these should be shared by server and client)
- script1.lua
- script2.lua
...
- Images (also shared by server and client)
- Image1.lua
- Image2.lua
...
I CAN include the scripts using
package.path = "../Scripts/?.lua;" .. package.path
However, I CANNOT add the images in the same way. love.graphics.newImage just won't find them
package.path = "../Images/?.png;" .. package.path
Also, when I distribute my game, this won't work as a .love file.
What I'd rather have is a way to change the conf.lua file depending on the command line arguments. But I cannot find a way to do this, since conf.lua runs _before_ I ever get to the arguments in love.load.
Any ideas?
love.graphics module must be disabled on the server at startup... otherwise I'll get errors and it won't run on my webserver.