Page 1 of 1
The newbie question
Posted: Sun Feb 08, 2015 5:39 am
by Periwasmarkedasspam
Hello im the newbie of the day, and i have a good question.
Code: Select all
function loadAssets()
assetimage = love.graphics.newImage
assets =
{
images =
{
splash = assetimage("splash.png")
}
}
end
function getImageAsset(theImage)
return assets[images][..""..theImage..""..]
end
Thats my actual code, that tries to create a asset thingy by using tables. The problem is at the function below. Any clue? I want to get the name of the image and ive tried using String thingys and dont work... Any clue? (Please some Admin, change my name
I wasnt able to create my account with outlook, and i had to create this gmail account... Strange. My wished name is Peri and yes i OBEY)
Re: The newbie question
Posted: Sun Feb 08, 2015 6:04 am
by Jasoco
The problem might be the .. before and after theAsset. And the empty quotes are useless and are doing nothing.
Re: The newbie question
Posted: Sun Feb 08, 2015 10:14 am
by Jeeper
The best thing to do is to post a .love file!
It is always recommended to do so unless you have a very specific question.
Re: The newbie question
Posted: Sun Feb 08, 2015 12:14 pm
by Robin
Without context, I'd say
Code: Select all
function getImageAsset(theImage)
return assets.images[theImage]
end
But yeah, we need a .love to give you a real answer.
Re: The newbie question
Posted: Sun Feb 08, 2015 2:10 pm
by Periwasmarkedasspam
Ok, now i have some other problems that i dont know why they are apearing.
Ill post the .love
The error:
Code: Select all
attempt to index global assets(a nil value)
is in a Require, idk if this is the problem.
Re: The newbie question
Posted: Sun Feb 08, 2015 5:30 pm
by Robin
Move the call to stateSystem() down to the end of the function. You've not yet called loadAssets() at the point you're calling stateSystem now.
Re: The newbie question
Posted: Sun Feb 08, 2015 6:12 pm
by Periwasmarkedasspam
Thanks! Ill post any other question here
Re: The newbie question
Posted: Sun Feb 08, 2015 6:35 pm
by Positive07
Periwasmarkedasspam wrote:Thanks! Ill post any other question here
Nope! Post a new thread or GTFO
Always wanted to use that hahaha. But for real, post a new thread and try to be more descriptive with your titles