Page 1 of 1

Get image from external directory.

Posted: Tue Apr 24, 2012 8:13 pm
by Arthes
Hi.
How to get images, and other stuff from other directory (other than content of .love)?
I tried:

Code: Select all

love.graphics.newImage(love.filesystem.load('C:\image.png'))
But it does not working.
Can you help me?
Thanks.

Re: Get image from external directory.

Posted: Tue Apr 24, 2012 8:15 pm
by Nixola
As far as I know, LOVE is sandboxed, so you can only read/write from the love file and %APPDATA%/LOVE/yourgame

Re: Get image from external directory.

Posted: Tue Apr 24, 2012 8:25 pm
by Boolsheet
Nixola wrote:LOVE is sandboxed
Just to prevent people from misunderstanding that: LÖVE does not stop you from going outside the read/write directories (The Lua IO library can). The love.filesystem module is designed to only access those 2 places for cross-platform reasons.

Re: Get image from external directory.

Posted: Wed Apr 25, 2012 8:31 am
by Ensayia
To clarify Boolsheet's point further, if you look in an external directory using the Lua IO functions, it won't be the same for each OS that LOVE supports. Directory structure is completely different in Windows, Mac, and Linux, adding external pathing will have to account for all three in a unique way and then things get messy.

Re: Get image from external directory.

Posted: Wed Apr 25, 2012 7:05 pm
by mickeyjm
Basically, just put the image in your .love and load it like that