Accessing config information

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
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Accessing config information

Post by MarekkPie »

Other than the screen dimensions, which can be reached via the love.graphics module, is there any way to access the information set in conf.lua inside the rest of the code? For example, accessing the title and author information, or whether the game is in Release Mode or not.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Accessing config information

Post by raidho36 »

You're having it hard-coded anyway, why not duplicate it into your target file?
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: Accessing config information

Post by MarekkPie »

Because I'm curious if there is a way or not.
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Accessing config information

Post by Plu »

I would guess it's stored somewhere in love. If you're interested in the stuff in the actual conf.lua file, you could always just call love.conf() again and read it from the table you passed into it. But not sure you'd get your hands on the table with the default values.
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: Accessing config information

Post by MarekkPie »

I'm assuming you mean:

Code: Select all

-- main.lua
local properties = {}

function love.conf(t)
  -- Set values
  properties = t
end

--...
That certainly seems hackish. I ran a for loop through the love module to see if it was somewhere in the top level, but I didn't notice anything. I'm assuming that they don't want you to be able to change the window title mid game, or flip from debug to release mode on the fly.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Accessing config information

Post by Nixola »

MarekkPie wrote:I'm assuming you mean:

Code: Select all

-- main.lua
local properties = {}

function love.conf(t)
  -- Set values
  properties = t
end

--...
That certainly seems hackish. I ran a for loop through the love module to see if it was somewhere in the top level, but I didn't notice anything. I'm assuming that they don't want you to be able to change the window title mid game, or flip from debug to release mode on the fly.
I don't think changing those informations, even if you found them, would actually do anything; anyway, love.graphics.setCaption
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: Accessing config information

Post by MarekkPie »

I'm looking more to get that information rather than set it, so the hack I described could work. However, it looks like they are implementing an additional module for some of that information, love.window, for version 0.9.0. There still doesn't seem to be anything that can tell whether an application is in release mode or not, beyond the above hack.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Accessing config information

Post by Lafolie »

As long as Löve itself does no trickery (which to my knowledge it doesn't) you should be able to open up the conf.lua file and read it yourself.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Post Reply

Who is online

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