Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibGUI: onUpdate() backward compatibility #154

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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