Page 1 of 1

Slash in parenthesis [SOLVED]

Posted: Fri May 10, 2019 4:05 pm
by test

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.

Re: Slash in parenthesis

Posted: Fri May 10, 2019 5:31 pm
by steVeRoll
I don't see anything wrong with the code you posted. Other than the useless concatenation of '1' and '/'.

Re: Slash in parenthesis

Posted: Fri May 10, 2019 9:18 pm
by raidho36
If you want to open "1/i.png" you should do just that.

Code: Select all

newImage ( "1/i.png" )
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".