Page 1 of 2
Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 8:41 am
by Draco_2k
tl;dr: love.filesystem makes it very clear it won't work on anything outside of userapp and .love directories, but is there any way to work with the filesystem at large? Custom modules or libraries?
Quick "Yes or No" question, I assume.
I'm looking into using Love for a not entirely game-related project - more or less a document editor - that'll need a working file browser and read/write for text, image and sound files from anywhere on the system. Is this possible? Are there any tricks, hacks, custom libraries, core Lua functions or anything else that would enable this?
Thanks!
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 10:10 am
by Robin
The short answer is yes.
The long answer is yes, but people will hate you.
Anyway, I don't think LÖVE will be of much use for the application you describe. Have you tried something like wxLua, for example?
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 10:24 am
by Draco_2k
That's a start, thanks!
I assume there's a hack around the limitations then? If there's anything better suited for this kind of stuff, that'd be great to hear too.
I only barely qualify as a script kiddie - but sometimes if you want to have something done, you have to do it yourself - so I'm looking for an engine that wouldn't make me write basic functions from the ground-up. Love is the best I've seen in that regard so far. I did try figuring out wxLua and official Lua libraries, but they're just way over my head.
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 10:58 am
by Robin
The Lua documentation has information about file I/O:
http://www.lua.org/manual/5.1/manual.html#5.7
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 11:00 am
by nevon
I would not recommend using Löve for general application development. The lack of a proper GUI toolkit alone will make you tear your hair out, and it won't behave like a native application.
There are
so many better options. Here are just a few:
Python+GTK,
PyQt,
QtLua.
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 11:26 am
by Draco_2k
Yep, I've tried it, but since it always returned nil I instantly assumed it didn't work (rather than blame my own incompetence). Does it really work?
EDIT: Yep, it works! Thanks! Now I just need to figure out how to get out of /user directory and do something actually useful.
nevon wrote:I would not recommend using Löve for general application development. The lack of a proper GUI toolkit alone will make you tear your hair out, and it won't behave like a native application.
Probably. But pretty much all lower-level languages are a closed road for me due to lack any experience whatsoever. At least Love allows you to do things like drawing images right away, and I don't need much more than organizing text and grouping some buttons.
QtLua looks like a possibility, so thanks a lot for that.
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 12:08 pm
by Robin
Draco_2k wrote:Probably. But pretty much all lower-level languages are a closed road for me due to lack any experience whatsoever.
Both Lua and Python are
very high level.
Draco_2k wrote:At least Love allows you to do things like drawing images right away, and I don't need much more than organizing text and grouping some buttons.
Trust me, using an actual GUI API (like the ones nevon and I linked to) is much easier than using LÖVE to make simple GUIs.
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 12:27 pm
by Draco_2k
Robin wrote:Trust me, using an actual GUI API (like the ones nevon and I linked to) is much easier than using LÖVE to make simple GUIs.
Yeah, I know. I'm just trying to figure out a way around my own ignorance: "love.graphics.draw(image, x, y)" is quite a bit better than trying to figure out what the hell is Python or what do the ten billion lines of wxWidget templates mean.
Since the I/O module works fine, it's a start.
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 2:21 pm
by Ellohir
With Java and Swing it's just click and drag to make a simple program GUI. Literally, it's ridiculously simple. I did some thing for Uni on Eclipse and was real easy
Just sayin' < /offtopic>
Re: Reading/Writing files anywhere on the system?
Posted: Thu Feb 09, 2012 2:47 pm
by Draco_2k
Yeah, that works pretty well. Problem being there's not really going to be any native GUI for what I have planned: it's less a bunch of menus and more spawned boxes you drag around and link together in a hierarchy.