Template repo for tiny cross-platform apps that can be modified on phone, tablet or computer.
add_files_to_dialog = function(x,y)
	for _,filename in ipairs(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)
					reset_file_dialog_state()
				end,
				--[[tooltip text]] nil,
				local_modifications_color(filename))
			x = x+w+10
		end
	end
	return y
end