diff --git a/frontend/apps/reader/modules/readerlink.lua b/frontend/apps/reader/modules/readerlink.lua index bb6fdcccd..3811aa27d 100644 --- a/frontend/apps/reader/modules/readerlink.lua +++ b/frontend/apps/reader/modules/readerlink.lua @@ -1593,7 +1593,7 @@ function ReaderLink:getButtonsForExternalLinkDialog(link_url) local button = fn_button(self, link_url) local show, button_title - if type(button.show_in_dialog_func) == "function" then + if button.show_in_dialog_func then show, button_title = button.show_in_dialog_func(link_url) else -- If the button doesn't have the show_in_dialog_func, then assume that the button diff --git a/frontend/ui/widget/button.lua b/frontend/ui/widget/button.lua index 7e5623d55..09b752956 100644 --- a/frontend/ui/widget/button.lua +++ b/frontend/ui/widget/button.lua @@ -80,7 +80,7 @@ function Button:init() end -- Prefer an optional text_func over text - if self.text_func and type(self.text_func) == "function" then + if self.text_func then self.text = self.text_func() end @@ -507,7 +507,7 @@ function Button:onTapSelectButton() end elseif self.tap_input then self:onInput(self.tap_input) - elseif type(self.tap_input_func) == "function" then + elseif self.tap_input_func then self:onInput(self.tap_input_func()) end end @@ -546,7 +546,7 @@ function Button:onHoldSelectButton() elseif self.hold_input then self:onInput(self.hold_input, true) self._hold_handled = true - elseif type(self.hold_input_func) == "function" then + elseif self.hold_input_func then self:onInput(self.hold_input_func(), true) self._hold_handled = true end diff --git a/frontend/ui/widget/checkbutton.lua b/frontend/ui/widget/checkbutton.lua index 71168d36e..4346cff25 100644 --- a/frontend/ui/widget/checkbutton.lua +++ b/frontend/ui/widget/checkbutton.lua @@ -127,7 +127,7 @@ function CheckButton:onTapCheckButton() if not self.enabled then return true end if self.tap_input then self:onInput(self.tap_input) - elseif type(self.tap_input_func) == "function" then + elseif self.tap_input_func then self:onInput(self.tap_input_func()) else if G_reader_settings:isFalse("flash_ui") then @@ -184,7 +184,7 @@ function CheckButton:onHoldCheckButton() elseif self.hold_input then self:onInput(self.hold_input, true) self._hold_handled = true - elseif type(self.hold_input_func) == "function" then + elseif self.hold_input_func then self:onInput(self.hold_input_func(), true) self._hold_handled = true end diff --git a/frontend/ui/widget/iconbutton.lua b/frontend/ui/widget/iconbutton.lua index de887b9c1..471430caf 100644 --- a/frontend/ui/widget/iconbutton.lua +++ b/frontend/ui/widget/iconbutton.lua @@ -152,7 +152,7 @@ function IconButton:onHoldIconButton() self.hold_callback() elseif self.hold_input then self:onInput(self.hold_input) - elseif type(self.hold_input_func) == "function" then + elseif self.hold_input_func then self:onInput(self.hold_input_func()) elseif not self.hold_callback then -- nil or false return