sokoban.love/0189-add_stash_files_to_dialog

22 lines
589 B
Plaintext

add_stash_files_to_dialog = function(x,y)
for _,filename in ipairs(Stash_directory_contents) do
if filename:find(File_dialog_input_text) then
local w = Font:getWidth(filename) + 10
if x ~= Menu_left+10 and x+w > Safe_width-Menu_left-10 then
x = Menu_left+10
y = y+Line_height+10
if y > Safe_height-Menu_bottom-10 then
break
end
end
styled_button(filename, x,y, function()
File_dialog_callback(filename, --[[is stash?]] true)
reset_file_dialog_state()
end,
--[[tooltip text]] nil,
Stash_color)
x = x+w+10
end
end
return y
end