Assuming you are not using the passed info table in your other disabled functions (and not using handlers) then you could use:
Lua Code:
local function GetInheritedDisabledStatus(info)
local option, options = info.options, { }
local disabled = option.disabled
for index = 1, #info - 1 do
option = option.args[info[index]]
options[index] = option
end
for index = #options, 1, -1 do
if options[index].disabled ~= nil then
disabled = options[index].disabled
break
end
end
if type(disabled) == "function" then
disabled = disabled()
end
return disabled
end
local function CreateSliderResetButton(order, forSituations, index1, index2)
return {
type = "execute",
name = "Reset",
order = order,
func =
function()
DynamicCam:SetSettingsDefault(forSituations, index1, index2)
end,
disabled =
function(info)
return DynamicCam:GetSettingsValue(forSituations, index1, index2) == DynamicCam:GetSettingsDefault(index1, index2) or GetInheritedDisabledStatus(info)
end,
}
end