extract a function

This commit is contained in:
Kartik K. Agaram 2023-11-26 09:53:09 -08:00
parent f1ddd6b8da
commit d71e7fcfc8
2 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,5 @@
settings_button = function(x)
local w = App.width('settings')
local x = x-5-w-5
styled_button('settings', x, Menu_top+5,
return right_justified_button('settings', x, Menu_top+5,
function()
Show_settings = not Show_settings
if Show_settings then Show_overflow = false end
@ -10,5 +8,4 @@ settings_button = function(x)
love.filesystem.write('config', json.encode(settings()))
end
end)
return x
end

View File

@ -0,0 +1,6 @@
right_justified_button = function(name, x, y, callback)
local w = App.width('settings')
local x = x-5-w-5
styled_button('settings', x, y, callback)
return x
end