sokoban.love/0116-save_button

19 lines
567 B
Plaintext

save_button = function(x, y, r)
return overflowable_button('save', x, y, r,
function()
Show_menu = nil
if Current_pane.filename == nil then
Show_file_dialog = true
File_dialog_callback = function(filename)
if filename == '' then return end
Current_pane.filename = filename
one_time_save()
-- Load new filename in future sessions.
-- On mobile devices, we can't depend on on.save_settings() triggering on quit.
love.filesystem.write('config', json.encode(settings()))
end
else
one_time_save()
end
end)
end