Skip to content

Commit

Permalink
LibGUI: onUpdate() backward compatibility (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiearzu authored Jun 11, 2024
1 parent 2fb52b9 commit b449022
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 b449022

Please sign in to comment.