Page 1 of 1

love 0.5.0 Patch to support game.conf comment lines

Posted: Thu Sep 25, 2008 7:14 pm
by TsT
Hello

I'm recently discover love2d, I like it.

I'm trying to make my own main.lua/game.conf

I fill my game.conf with all existing parameters.
Some of them must not be use.

Code: Select all

love_version = "0.5.0"
title = "my client"
author = "TsT"
-- width         Display resolution width.
-- height       Display resolution height.
-- fullscreen   True if fullscreen, false otherwise.
-- vsync        True if attemt to enable, false otherwise.
-- fsaa         Number of FSAA-buffers.
-- display_auto         Set this to false if you want to configure the display in Lua manually.
-- love_version         The LOVE-version this game was made for.


I propose to support the lua comment (line prefixed by "--").

See the patch :

Code: Select all

--- love-0.5-0/src/liblove/Configuration.cpp  2008-09-20 16:40:17.000000000 +0200
+++ love-0.5-0-tst1/src/liblove/Configuration.cpp     2008-09-25 20:55:55.000000000 +0200
@@ -62,6 +62,8 @@
                {
                        line++;
                        index = (int)temp.find_first_of('=', 0);
+                       if(temp.substr(0, 2) == "--")
+                               continue;
                        if(index == (int)string::npos)
                                printf("Configuration (Line %d): Unrecognized command: \"%s\"\n", line, temp.c_str());
                        if(index != (int)string::npos && temp.find_first_of('#', 0) != 0 && trim(temp).size() != 0)

Re: love 0.5.0 Patch to support game.conf comment lines

Posted: Thu Sep 25, 2008 9:35 pm
by Nexion
I don't know if the .conf files support it, but I know a lot of configuration files and stuff use the C style comment of //

Re: love 0.5.0 Patch to support game.conf comment lines

Posted: Fri Sep 26, 2008 3:54 pm
by rude
Cool, but appearently I can't apply the patch. (It's about time I learned this).

Which directory do I have to "be" in?

Re: love 0.5.0 Patch to support game.conf comment lines

Posted: Mon Sep 29, 2008 8:54 am
by TsT
Which directory do I have to "be" in?
if you are under Linux you can try:
cd /path/to/your/love/
patch -p1 < /path/to/my/patch

Else you can edit my patch and change :

Code: Select all

--- love-0.5-0/src/liblove/Configuration.cpp  2008-09-20 16:40:17.000000000 +0200
+++ love-0.5-0-tst1/src/liblove/Configuration.cpp     2008-09-25 20:55:55.000000000 +0200
To:

Code: Select all

--- src/liblove/Configuration.cpp  2008-09-20 16:40:17.000000000 +0200
+++ src/liblove/Configuration.cpp     2008-09-25 20:55:55.000000000 +0200
The file patch is "src/liblove/Configuration.cpp"

And to support C++ comment you can patch with :

Code: Select all

if(temp.substr(0, 2) == "--" || temp.substr(0, 2) == "//")
    continue;