Gather files from another folder

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.
Post Reply
Char Jones
Posts: 1
Joined: Wed Oct 30, 2019 7:07 pm

Gather files from another folder

Post by Char Jones » Wed Oct 30, 2019 7:16 pm

Hello, new around here and I just have one question.
I have the folder structure like this to keep my files organized:

+ src
* player.lua
+ assets
* img
- panda.png
+ main.lua

But I want to retrieve the 'panda.png' from player.lua like'./../assets/img/panda.png') but tells me the file doesn't exists, there's a special way to do it?
Thanks in advance

User avatar
Inner party member
Posts: 3651
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA

Re: Gather files from another folder

Post by Jasoco » Wed Oct 30, 2019 8:53 pm

I'm not completely sure how to read your folder structure. Use the Code tags to format it with spaces denoting folders so it's easier.

Code: Select all

(Is that close to what you have it set up as?)

Anyway, is the image file not loading when you put the path in? It's relative. With the root folder where the main.lua file is being the top of the structure. So if that image is just in a folder called img at the root of the project then it would just be "img/panda.png". (Or if it's img inside assets then it's "/assets/img/panda.png") You don't need the ../ stuff.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests