conf.lua is not affecting the rest of the game

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
vitto
Prole
Posts: 10
Joined: Wed Nov 19, 2014 5:50 pm
Location: Italy
Contact:

conf.lua is not affecting the rest of the game

Post by vitto »

I'm trying to set some default param on my [wiki]Config_Files[/wiki] to give a base of params for my game, for example:

Code: Select all

-- file conf.lua
function love.conf(t)
    t.identity = "Game name"
end
Then I'm try to read the data from it without success:

Code: Select all

-- file main.lua
function love.draw()
    local identity
    identity = love.filesystem.getIdentity()
    love.graphics.print(identity, 20, 50) -- this writes on the window "game" instead of "Game name"
end
Is conf.lua supposed to be used to set there default values, and if yes, how should i retrieve these data?
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: conf.lua is not affecting the rest of the game

Post by Azhukar »

Conf.lua is to configure the startup of love framework, not for actual values specific to your game.

getIdentity and setIdentity are for setting the write directory for your game, also called savegame folder. This is also the folder where you will want to save user settings later on, should you code any.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: conf.lua is not affecting the rest of the game

Post by s-ol »

Azhukar wrote:Conf.lua is to configure the startup of love framework, not for actual values specific to your game.

getIdentity and setIdentity are for setting the write directory for your game, also called savegame folder. This is also the folder where you will want to save user settings later on, should you code any.
He is getting the value back from love though, so "basically" this should work - I have no idea how the love.filesystem api works though.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: conf.lua is not affecting the rest of the game

Post by Azhukar »

S0lll0s wrote:He is getting the value back from love though
No he is not.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: conf.lua is not affecting the rest of the game

Post by slime »

vitto wrote:I'm trying to set some default param on my [wiki]Config_Files[/wiki] to give a base of params for my game, for example:

Code: Select all

-- [...]
Is conf.lua supposed to be used to set there default values, and if yes, how should i retrieve these data?
That code works for me (it displays 'Game name' onscreen.) Do you have anything else in your love.conf function that might be causing an error when love tries to load it?

Azhukar wrote:Conf.lua is to configure the startup of love framework, not for actual values specific to your game.

getIdentity and setIdentity are for setting the write directory for your game, also called savegame folder. This is also the folder where you will want to save user settings later on, should you code any.
conf.lua configures values of LÖVE specific to your game. The t.identity field in [wiki]love.conf[/wiki] sets the game's write directory.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: conf.lua is not affecting the rest of the game

Post by Azhukar »

slime wrote:The t.identity field in [wiki]love.conf[/wiki] sets the game's write directory.
My mistake, didn't realize it was identity as he wasn't getting the correct value. Perhaps the space causes some strange bug?
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: conf.lua is not affecting the rest of the game

Post by Positive07 »

Azhukar wrote:
slime wrote:The t.identity field in [wiki]love.conf[/wiki] sets the game's write directory.
My mistake, didn't realize it was identity as he wasn't getting the correct value. Perhaps the space causes some strange bug?
No it isnt (I'm answering like you do ;) )
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
iggyvolz
Prole
Posts: 14
Joined: Sun Nov 23, 2014 11:11 pm

Re: conf.lua is not affecting the rest of the game

Post by iggyvolz »

Oddly enough, I've been having problems with the identity functions not changing in the actual script, but pasting your example works fine for me.

What platform are you on? That might help to diagnose the issue.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: conf.lua is not affecting the rest of the game

Post by Azhukar »

Positive07 wrote:No it isnt (I'm answering like you do ;) )
Only you're making neither grammatical nor contextual sense. I appreciate you trying to be more succinct, it saves a lot of time.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: conf.lua is not affecting the rest of the game

Post by s-ol »

Azhukar wrote:
Positive07 wrote:No it isnt (I'm answering like you do ;) )
Only you're making neither grammatical nor contextual sense. I appreciate you trying to be more succinct, it saves a lot of time.
Dude, seriously. This is a forum, people are coming here for help and social interaction. In a forum you try to strike a balance between good conversation and information and your short and cold answers are useless. If you disagree, state why, be productive and help out. If you agree, motivate. If you are tired of people asking questions that were answered before or that you do not seem worthy being asked then fucking ignore it.
A forum is not a place where information density or anything like that matters, people asking questions are usually thankful for longer and more detailed answers. With your post style you are mostly just being a dick. You can talk about how you are only to-the-point all you want but your posts make you a dick, no more, no less.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest