"Save as..."

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
User avatar
RonanZero
Citizen
Posts: 90
Joined: Mon Oct 20, 2014 3:33 am

"Save as..."

Post by RonanZero »

Is there a way I can use the Windows "Save as..." prompt? I'm using LÖVE for my animation editor and I want to write data to a file, which isn't a problem, but I want the user to be able to set the file name. The easiest way to do this would be to use the windows save as. What's the easiest alternative if I can't do that?
while true do end;
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: "Save as..."

Post by pgimeno »

"Save as" is not a Windows prompt. You probably mean a native file save dialog. LÖVE doesn't have direct support for that, but it's possible. This thread has file open dialogs, which are similar but with some differences: https://www.love2d.org/forums/viewtopic.php?f=4&t=82442 but show that it's certainly possible.

Of course, if you make it for Windows only, the application will crash for us Linux users, as well as for Mac users.

Alternatively, linux-man is working on the LoveFS library that implements file dialogs in LÖVE itself: https://www.love2d.org/forums/viewtopic.php?f=5&t=9479
User avatar
Beelz
Party member
Posts: 234
Joined: Thu Sep 24, 2015 1:05 pm
Location: New York, USA
Contact:

Re: "Save as..."

Post by Beelz »

Just throwing an idea out there... I imagine it would be possible to implement this like the message boxes. Not saying easy, but possible for someone more skilled than I.

Code: Select all

if self:hasBeer() then self:drink()
else self:getBeer() end
GitHub -- Website
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: "Save as..."

Post by Positive07 »

I actually use NativeFileDialog library you can see a related post here, and the actual wrapper code to use it in Lua/LÖVE is here at this repo, I also created a pull request explaining how to compile for Windows, I can't help you compiling them sorry, but I can help you fix whatever problem you find.

I don't know if such a library is what you are looking for, since it's a binary library. If it is however I recommend it, otherwise I recommend you take a look at LoveFS which looks rather amazing! or alternatively you can modify the code posted at this post with FFI implementations so that they are Save Dialogs instead of Open Dialogs.

PS: Pgimeno already posted both of these links I'm putting all together anyway but credits to him!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Post Reply

Who is online

Users browsing this forum: No registered users and 79 guests