General discussion about LÖVE, Lua, game development, puns, and unicorns.
Periwasmarkedasspam
Prole
Posts: 9 Joined: Sun Feb 08, 2015 5:30 am
Post
by Periwasmarkedasspam » Sun Feb 08, 2015 5:39 am
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)
Jasoco
Inner party member
Posts: 3727 Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:
Post
by Jasoco » Sun Feb 08, 2015 6:04 am
The problem might be the .. before and after theAsset. And the empty quotes are useless and are doing nothing.
Jeeper
Party member
Posts: 611 Joined: Tue Mar 12, 2013 7:11 pm
Contact:
Post
by Jeeper » Sun Feb 08, 2015 10:14 am
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.
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Sun Feb 08, 2015 12:14 pm
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.
Periwasmarkedasspam
Prole
Posts: 9 Joined: Sun Feb 08, 2015 5:30 am
Post
by Periwasmarkedasspam » Sun Feb 08, 2015 2:10 pm
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.
Attachments
ironBuckshot.love
(7.36 KiB) Downloaded 108 times
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Sun Feb 08, 2015 5:30 pm
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.
Positive07
Party member
Posts: 1014 Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina
Post
by Positive07 » Sun Feb 08, 2015 6:35 pm
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
for i, person
in ipairs (everybody)
do
[tab] if not person.obey
then person:setObey(
true )
end
end
love.system.openURL(
github.com/pablomayobre )
Users browsing this forum: Ahrefs [Bot] , Google [Bot] and 6 guests