config.lua is being ignored

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.
somebodyelse
Prole
Posts: 11
Joined: Thu Feb 13, 2014 4:49 am

config.lua is being ignored

Post by somebodyelse »

I am trying to use a conf.lua file for my game as described on this page: http://www.love2d.org/wiki/Config_Files

The entire file seems to be ignored. The Window Title does not change, nothing changes. The code I'm using is:

config.lua:

Code: Select all

function love.conf(t)
    t.identity = nil                   -- The name of the save directory (string)
    t.version = "0.9.0"                -- The LÖVE version this game was made for (string)
    t.console = false                  -- Attach a console (boolean, Windows only)

    t.window.title = "Collision Test"        -- The window title (string)
    t.window.icon = nil                -- Filepath to an image to use as the window's icon (string)
    t.window.width = 800               -- The window width (number)
    t.window.height = 600              -- The window height (number)
    t.window.borderless = false        -- Remove all border visuals from the window (boolean)
    t.window.resizable = false         -- Let the window be user-resizable (boolean)
    t.window.minwidth = 1              -- Minimum window width if the window is resizable (number)
    t.window.minheight = 1             -- Minimum window height if the window is resizable (number)
    t.window.fullscreen = false        -- Enable fullscreen (boolean)
    t.window.fullscreentype = "normal" -- Standard fullscreen or desktop fullscreen mode (string)
    t.window.vsync = true              -- Enable vertical sync (boolean)
    t.window.fsaa = 0                  -- The number of samples to use with multi-sampled antialiasing (number)
    t.window.display = 1               -- Index of the monitor to show the window in (number)
    t.window.highdpi = false           -- Enable high-dpi mode for the window on a Retina display (boolean). Added in 0.9.1
    t.window.srgb = false              -- Enable sRGB gamma correction when drawing to the screen (boolean). Added in 0.9.1

    t.modules.audio = true             -- Enable the audio module (boolean)
    t.modules.event = true             -- Enable the event module (boolean)
    t.modules.graphics = true          -- Enable the graphics module (boolean)
    t.modules.image = true             -- Enable the image module (boolean)
    t.modules.joystick = true          -- Enable the joystick module (boolean)
    t.modules.keyboard = true          -- Enable the keyboard module (boolean)
    t.modules.math = true              -- Enable the math module (boolean)
    t.modules.mouse = true             -- Enable the mouse module (boolean)
    t.modules.physics = true           -- Enable the physics module (boolean)
    t.modules.sound = true             -- Enable the sound module (boolean)
    t.modules.system = true            -- Enable the system module (boolean)
    t.modules.timer = true             -- Enable the timer module (boolean)
    t.modules.window = true            -- Enable the window module (boolean)
end
Not sure what I'm doing wrong, but does anybody have any ideas why it's not working? How can I get the config file to work? I am using Love 0.9.0.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: config.lua is being ignored

Post by slime »

The file should be named 'conf.lua'.
somebodyelse
Prole
Posts: 11
Joined: Thu Feb 13, 2014 4:49 am

Re: config.lua is being ignored

Post by somebodyelse »

slime wrote:The file should be named 'conf.lua'.
It is :)
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: config.lua is being ignored

Post by bartbes »

Except you keep calling it config.lua. Also make sure that it's right next to main.lua, and nowhere else.
somebodyelse
Prole
Posts: 11
Joined: Thu Feb 13, 2014 4:49 am

Re: config.lua is being ignored

Post by somebodyelse »

bartbes wrote:Except you keep calling it config.lua. Also make sure that it's right next to main.lua, and nowhere else.
Sorry about that, in the actual filename it is conf.lua. I kept calling it config.lua because it's a config-uration file :-/ And it's in the root directory, right next to main.lua. I managed to sort this out, though. Turns our I was missing

Code: Select all

require("conf.lua")
at the top of my main.lua file.
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: config.lua is being ignored

Post by Jeeper »

somebodyelse wrote:
bartbes wrote:Except you keep calling it config.lua. Also make sure that it's right next to main.lua, and nowhere else.
Sorry about that, in the actual filename it is conf.lua. I kept calling it config.lua because it's a config-uration file :-/ And it's in the root directory, right next to main.lua. I managed to sort this out, though. Turns our I was missing

Code: Select all

require("conf.lua")
at the top of my main.lua file.
That is very odd, I have never had to "require" my conf file before.

Also a tip for the future, if you post a .love it is much easier for us to help you. 99% of the time people can not give enough information as they do not know why their program is not working.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: config.lua is being ignored

Post by slime »

somebodyelse wrote:
bartbes wrote:Except you keep calling it config.lua. Also make sure that it's right next to main.lua, and nowhere else.
Sorry about that, in the actual filename it is conf.lua. I kept calling it config.lua because it's a config-uration file :-/ And it's in the root directory, right next to main.lua. I managed to sort this out, though. Turns our I was missing

Code: Select all

require("conf.lua")
at the top of my main.lua file.
If the file is named conf.lua and it has a function named love.conf as defined in the [wiki]Config Files[/wiki] wiki page, then it will get executed automatically by LÖVE before main.lua is loaded. Requiring it from main.lua won't actually do anything because the love.conf function is only called by LÖVE before main.lua is loaded.

[also the require syntax for that should be require("conf"), otherwise it'll error.]
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: config.lua is being ignored

Post by bartbes »

slime wrote: [also the require syntax for that should be require("conf"), otherwise it'll error.]
Unless you're using an ancient version of love, maybe?
Automatik
Citizen
Posts: 57
Joined: Sun Feb 17, 2013 7:05 pm

Re: config.lua is being ignored

Post by Automatik »

His version is 0.9.0:
somebodyelse wrote:

Code: Select all

function love.conf(t)
    t.identity = nil                   -- The name of the save directory (string)
    t.version = "0.9.0"                -- The LÖVE version this game was made for (string)
    [etc.]
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: config.lua is being ignored

Post by slime »

He's using 0.9's love.conf template at least, but that doesn't necessarily mean it's being run using LÖVE 0.9.0 - I hope so though! :)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 8 guests