Dumb question : Love.config(t)

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
SatoKato
Prole
Posts: 4
Joined: Sun Jun 04, 2017 2:53 pm

Dumb question : Love.config(t)

Post by SatoKato »

Hello, I created a config.lua with this code:

Code: Select all

function love.conf(t)
    t.window.width = 1280
    t.window.height = 720  
    t.modules.joystick = false
    end
Is there a way to call it in main.lua? :o

thanks for your times!
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Dumb question : Love.config(t)

Post by Sir_Silver »

Not 100% sure on this, but I think you just need to call it conf.lua and have it in the same folder as main.lua and it should work without having to call require yourself.
User avatar
yetneverdone
Party member
Posts: 448
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Dumb question : Love.config(t)

Post by yetneverdone »

SatoKato wrote: Sun Jun 04, 2017 2:58 pm Hello, I created a config.lua with this code:

Code: Select all

function love.conf(t)
    t.window.width = 1280
    t.window.height = 720  
    t.modules.joystick = false
    end
Is there a way to call it in main.lua? :o

thanks for your times!
lua also checks for a file named conf.lua, if that exists, lua will automatically run that. So no worries :)
SatoKato
Prole
Posts: 4
Joined: Sun Jun 04, 2017 2:53 pm

Re: Dumb question : Love.config(t)

Post by SatoKato »

yetneverdone wrote: Sun Jun 04, 2017 6:25 pm
SatoKato wrote: Sun Jun 04, 2017 2:58 pm Hello, I created a config.lua with this code:

Code: Select all

function love.conf(t)
    t.window.width = 1280
    t.window.height = 720  
    t.modules.joystick = false
    end
Is there a way to call it in main.lua? :o

thanks for your times!
lua also checks for a file named conf.lua, if that exists, lua will automatically run that. So no worries :)
Thank you!
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Dumb question : Love.config(t)

Post by Nixola »

Lua does not do that; LÖVE does. (Lua also doesn't automatically look for any file; that's still LÖVE.)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Dumb question : Love.config(t)

Post by zorg »

Since conf.lua is loaded before main.lua is (and by that time, the modules would have been loaded), you can't exactly define the conf function in main.lua... what you can do though, is defer window creation from conf.lua to somewhere else (like love.load in your main.lua or wherever):

Code: Select all

-- In conf.lua (I'm leaving out stuff...)

t.window = false -- Don't create a graphical window just yet...

-- In another file, let's say main.lua for example

function love.load(args)
    -- Create the window
    love.window.setMode(800, 600, {vsync=false})
end
This is neat if you need to parse stuff after conf.lua and only create the window after, based on that data... meaning it won't flash the window twice this way, which would be annoying.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
yetneverdone
Party member
Posts: 448
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Dumb question : Love.config(t)

Post by yetneverdone »

Nixola wrote: Sun Jun 04, 2017 9:07 pm Lua does not do that; LÖVE does. (Lua also doesn't automatically look for any file; that's still LÖVE.)
Oh yeah, i mixed lua and love always. Thanks for clarifying
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests