Hello, new around here and I just have one question.
I have the folder structure like this to keep my files organized:
root
+ src
* player.lua
+ assets
* img
- panda.png
+ main.lua
But I want to retrieve the 'panda.png' from player.lua like love.graphics.newImage('./../assets/img/panda.png') but tells me the file doesn't exists, there's a special way to do it?
Thanks in advance
Gather files from another folder
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Gather files from another folder
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.
(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.
Code: Select all
main.lua
img/
panda.png
src/
player.lua
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.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests