love 0.5.0 Patch to support game.conf comment lines

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
TsT
Party member
Posts: 161
Joined: Thu Sep 25, 2008 7:04 pm
Location: France
Contact:

love 0.5.0 Patch to support game.conf comment lines

Post 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)
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
User avatar
Nexion
Prole
Posts: 46
Joined: Fri Sep 05, 2008 1:40 pm

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

Post 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 //
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

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

Post 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?
User avatar
TsT
Party member
Posts: 161
Joined: Thu Sep 25, 2008 7:04 pm
Location: France
Contact:

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

Post 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;
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
Post Reply

Who is online

Users browsing this forum: No registered users and 48 guests