To clarify, WoW addon code is loaded sequentially and an infinite loop would halt it.
Using an event like LEARNED_SPELL_IN_TAB may help as it fires when a new spell is added/learned.
Lua Code:
local frame = CreateFrame('Frame')
frame:SetScript('OnEvent', function(self, event, ...)
frame[event](self, ...)
end
function frame:LEARNED_SPELL_IN_TAB(self, ...)
local a = IsSpellKnown(72, false)
local b = IsSpellKnown(73, false)
local c = IsSpellKnown(74, false)
local d = IsSpellKnown(75, false)
if a and b and c and d then
ChangeActionBarPage(2)
end
end
frame:RegisterEvent("LEARNED_SPELL_IN_TAB")