Fix undeclared NagView findindex() by moving it to common.

This commit is contained in:
jgmdev
2021-06-13 21:28:29 -04:00
parent 98164f6d4f
commit e070dbebc1
3 changed files with 11 additions and 9 deletions
+1 -7
View File
@@ -170,12 +170,6 @@ function NagView:draw()
end
end
local function findindex(tbl, prop)
for i, o in ipairs(tbl) do
if o[prop] then return i end
end
end
function NagView:get_message_height()
local h = 0
for str in string.gmatch(self.message, "(.-)\n") do
@@ -196,7 +190,7 @@ function NagView:next()
-- self.target_height is the nagview height needed to display the message and
-- the buttons, excluding the top and bottom padding space.
self.target_height = math.max(message_height, self:get_buttons_height())
self:change_hovered(findindex(self.options, "default_yes"))
self:change_hovered(common.find_index(self.options, "default_yes"))
end
self.force_focus = self.message ~= nil
core.set_active_view(self.message ~= nil and self or core.last_active_view)