love.conf not working?

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
RisuTheGrate
Prole
Posts: 3
Joined: Thu Mar 02, 2023 5:04 am

love.conf not working?

Post by RisuTheGrate »

Hi everyone, so I have a conf.lua file where I put my love.conf function in. But when I require the file in main.lua, everything I wrote inside conf.lua seems to be ignored. I'm not sure why. Here is my file structure:

Image

And here is the code inside conf.lua and main.lua respectively:

Code: Select all

-- Code in conf.lua
function love.conf(t)
    t.window.with = 1280
    t.window.height = 720
end

Code: Select all

-- Code in main.lua
function love.load()
    require("Conf.conf")
    require("Objects.mainCharacter")
    require("Objects.rect")
    require("Objects.floor")

    love.window.setTitle("Object Follow Test")
end

function love.update(dt)
    mainCharacter:update(dt)
    rect:update()
    floor:update()
end

function love.draw()
    mainCharacter:draw()
    rect:draw()
    floor:draw()
end
Any help is appreciated!
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: love.conf not working?

Post by Bigfoot71 »

The conf.lua file must be in the same directory as the main.lua and you don't need to call it with require, love2d loads it automatically.

Additionally you can also set the window name in conf.lua like this:

Code: Select all

function love.conf(t)
    t.window.title = "My awesome game name"
end
https://love2d.org/wiki/Config_Files
Last edited by Bigfoot71 on Sat Mar 04, 2023 2:11 pm, edited 1 time in total.
My avatar code for the curious :D V1, V2, V3.
RisuTheGrate
Prole
Posts: 3
Joined: Thu Mar 02, 2023 5:04 am

Re: love.conf not working?

Post by RisuTheGrate »

Do I still have to require the conf.lua file?
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: love.conf not working?

Post by Bigfoot71 »

Sorry I just edited it, no you don't need it, love2d loads it automatically.
My avatar code for the curious :D V1, V2, V3.
RisuTheGrate
Prole
Posts: 3
Joined: Thu Mar 02, 2023 5:04 am

Re: love.conf not working?

Post by RisuTheGrate »

Okay, thank you for the help!
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests