Page 1 of 2

.conf /.cfg?

Posted: Mon Nov 17, 2008 8:10 am
by MHD
Are there any specific reason why Löve doesn't use .cfg files?

Re: .conf /.cfg?

Posted: Mon Nov 17, 2008 1:27 pm
by mike
Yes. We didn't think about it. Do you want to be able to use .cfg as well? Is this good for anything? Rude?

Re: .conf /.cfg?

Posted: Mon Nov 17, 2008 1:42 pm
by u9_
I might be wrong about this but typical configuration filenames in linux end with .conf and in windows they end with .cfg? Or is it just microsoft that uses .cfg for some office (or visual studio) files?

Anyways, personally i think it doesn't really matter.

Re: .conf /.cfg?

Posted: Mon Nov 17, 2008 2:35 pm
by bartbes
I'm thinking
thoughts wrote:why not?
I mean conf and cfg are both used, and as u9_ says I guess Linux uses conf more.
There's nothing against either, and it seems to be whatever the programmer thinks of first.

Re: .conf /.cfg?

Posted: Mon Nov 17, 2008 3:08 pm
by mike
bartbes wrote:I'm thinking
thoughts wrote:why not?
This is an issue that comes up now and then: where do we stand on enforcing our way vs allowing for other ways of doing things. On one hand it would probably be good for the person who has used cfg files elsewhere, but would the increase in code, file size and processing time really be worth it to appease that one guy? It's such a small thing to be concerned about (wouldn't be much work either), but in the long run it would be counter-productive to always bend LÖVE to people's every whim as the end result would be a bloated piece of software that tries to please everyone.

I am still unsure about this so I will leave it to rude to decide it's fate. I could go either way...

Re: .conf /.cfg?

Posted: Tue Nov 18, 2008 4:03 am
by subrime
So a bit of lua history: it was originally designed as a configuration language.

This is lua's strong suit, and the love infrastructure already provides the ability to do this in a simple manner: it's called the load function. If you have your configuration settings in a file called 'something.conf', this should work:

Code: Select all

function load()
  dofile 'something.conf' -- load in the settings
-- etc
end
The only thing to remember is that the file that you load must conform to lua syntax, but this is an advantage since this is exactly the kind of the task lua syntax is optimized for.

Re: .conf /.cfg?

Posted: Tue Nov 18, 2008 7:02 am
by bartbes
I actually used the following code to create a (personal) hook program:

Code: Select all

love.filesystem.include("game.conf")
if not width then width = love.graphics.getWidth() end
if not height then height = love.graphics.getHeight() end
if not fullscreen then fullscreen = false end
if not vsync then vsync = false end
if not fsaa then fsaa = 0 end
love.graphics.setMode(width, height, fullscreen, vsync, fsaa)
love.graphics.setCaption(title)
And it works as intended, only problem is that the window "opens" twice.
It appears, and quickly disappears, only to appear again (however, this takes 1 sec, and it might have to do something with the amount of code in front of that).

Re: .conf /.cfg?

Posted: Tue Nov 18, 2008 8:11 am
by rude
Use display_auto = false in the config file if you want the create the initial window yourself.

If you use love.system.restart(), you should also check whether a window is already created, like this:

Code: Select all

if not love.graphics.isCreated() then
    love.graphics.setMode( ... )
end
About .conf vs .cfg: this is probably the first really pointless discussion here so far. :D

EDIT:

Code: Select all

-- I would not do this:
if not width then width = love.graphics.getWidth() end
if not height then height = love.graphics.getHeight() end
-- This is more like it:
if not width then width = 800 end
if not height then height = 600 end

Re: .conf /.cfg?

Posted: Tue Nov 18, 2008 3:56 pm
by bartbes
Looks like nothing is going to change :D

@rude:
Well it was just a personal thingy, not made for performance or whatever.

Re: .conf /.cfg?

Posted: Wed Nov 19, 2008 6:22 am
by tido
ACTUALLY...

*.conf DOES use ONE WHOLE EXTRA BYTE of RESOURCES because of the extra letter (*.cfg has only three). So technically, it will take a few more CPU cycles to parse that string. :shock:

Also, I'm pretty sure it will use some more cycles looking the file up on the drive.