Skip to content

Commit

Permalink
Backward compatibility support
Browse files Browse the repository at this point in the history
Fix LibGUI to be backward compatible when calling the method "update()" who was renamed to "onUpdate()"
  • Loading branch information
frankiearzu committed Jun 11, 2024
1 parent 2fb52b9 commit 185ea2f
Show file tree
Hide file tree
Showing 2 changed files with 1,040 additions and 899 deletions.
4 changes: 3 additions & 1 deletion sdcard/c480x272/WIDGETS/LibGUI/libgui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ function M.newGUI()
local guiFocus = not gui.parent or (focused and gui.parent.editing)
for idx, element in ipairs(_.elements) do
-- Clients may provide an update function for elements
if element.onUpdate then
if element.onUpdate then -- new name the method
element.onUpdate(element)
elseif element.update then -- For backward compatibility
element.update(element)
end
if not element.hidden then
element.draw(_.focus == idx and guiFocus)
Expand Down
Loading

0 comments on commit 185ea2f

Please sign in to comment.