Skip to content

Commit

Permalink
Removed backward comp fix for monarch.back()
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Jan 12, 2024
1 parent 00c3079 commit 4c6e26f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion example/advanced/confirm.gui_script
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function on_input(self, action_id, action)
end
elseif gui.pick_node(self.no, action.x, action.y) then
print("no")
monarch.back(function()
monarch.back(nil, nil, function()
print("back from popup done")
end)
end
Expand Down
2 changes: 1 addition & 1 deletion example/advanced/popup.gui_script
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function on_input(self, action_id, action)
end)
elseif gui.pick_node(self.cancel, action.x, action.y) then
print("cancel")
monarch.back(function()
monarch.back(nil, nil, function()
print("back from popup done")
end)
elseif gui.pick_node(self.about, action.x, action.y) then
Expand Down
2 changes: 1 addition & 1 deletion example/advanced/pregame.gui_script
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function on_input(self, action_id, action)
end)
elseif gui.pick_node(self.back, action.x, action.y) then
print("back")
monarch.back(function()
monarch.back(nil, nil, function()
print("back from pregame done")
end)
end
Expand Down
12 changes: 1 addition & 11 deletions monarch/monarch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ function M.hide(id, cb)
log("hide() you can only hide the screen at the top of the stack", id)
return false
end
return M.back(id, cb)
return M.back(nil, nil, cb)
else
log("hide() queuing action", id)
queue_action(function(action_done, action_error)
Expand Down Expand Up @@ -986,16 +986,6 @@ end
-- @param cb (function) - Optional callback to invoke when the previous screen is visible again
function M.back(options, data, cb)
log("back() queuing action")
-- backwards compatibility with old version M.back(data, cb)
-- case when back(data, cb)
if type(data) == "function" then
cb = data
data = options
options = nil
-- case when back(data, nil)
elseif options ~= nil and data == nil and cb == nil then
data = options
end

queue_action(function(action_done)
local callbacks = callback_tracker()
Expand Down

0 comments on commit 4c6e26f

Please sign in to comment.