Page 1 of 1
Accessing config information
Posted: Thu Oct 03, 2013 5:00 pm
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.
Re: Accessing config information
Posted: Thu Oct 03, 2013 5:19 pm
by raidho36
You're having it hard-coded anyway, why not duplicate it into your target file?
Re: Accessing config information
Posted: Thu Oct 03, 2013 7:49 pm
by MarekkPie
Because I'm curious if there is a way or not.
Re: Accessing config information
Posted: Thu Oct 03, 2013 9:01 pm
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.
Re: Accessing config information
Posted: Fri Oct 04, 2013 4:34 am
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.
Re: Accessing config information
Posted: Fri Oct 04, 2013 6:18 am
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
Re: Accessing config information
Posted: Sun Oct 06, 2013 12:04 am
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.
Re: Accessing config information
Posted: Sun Oct 06, 2013 4:06 am
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.