Code:
function TMW:LoadOptions(recursed)
if IsAddOnLoaded("TellMeWhen_Options") then
return true
end
TMW:Print(L["LOADINGOPT"])
local loaded, reason = LoadAddOn("TellMeWhen_Options")
if not loaded then
if reason == "DISABLED" and not recursed then -- prevent accidental recursion
TMW:Print(L["ENABLINGOPT"])
EnableAddOn("TellMeWhen_Options")
TMW:LoadOptions(1)
else
local err = L["LOADERROR"] .. _G["ADDON_"..reason]
TMW:Print(err)
geterrorhandler()(err, 0) -- non breaking error
end
else
-- successfully loaded, do stuff here
end
end