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 .
test
Prole
Posts: 28 Joined: Sun Apr 14, 2019 2:36 pm
Post
by test » Fri May 10, 2019 4:05 pm
Code: Select all
for i = 1, 4 do img[i] = love.graphics.newImage('1' .. '/' .. i .. '.png') end
I want to open the i.png in the folder which is named '1'. How can I achieve this? Thanks.
Last edited by
test on Fri May 17, 2019 9:56 am, edited 1 time in total.
steVeRoll
Party member
Posts: 140 Joined: Sun Feb 14, 2016 1:13 pm
Post
by steVeRoll » Fri May 10, 2019 5:31 pm
I don't see anything wrong with the code you posted. Other than the useless concatenation of '1' and '/'.
raidho36
Party member
Posts: 2063 Joined: Mon Jun 17, 2013 12:00 pm
Post
by raidho36 » Fri May 10, 2019 9:18 pm
If you want to open "1/i.png" you should do just that.
In the code you posted, the string is produced out of whatever was in variable "i", which is numbers 1 through 4, so it would load "1/1.png", "1/2.png", "1/3.png" and "1/4.png".
Users browsing this forum: Ahrefs [Bot] , Google [Bot] and 5 guests