Macro to change spec LUA error since patch

Hi all,

For years I have been using macro to change spec:
/run SetSpecialization(1)

Since patch, it reports a LUA error

Message: [string “SetSpecialization(1)”]:1: attempt to call global ‘SetSpecialization’ (a nil value)
Time: Wed Mar 12 13:59:18 2025
Count: 1
Stack:
[Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua]:2308: in function ‘?’
[Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua]:5517: in function ‘ChatEdit_ParseText’
[Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua]:5169: in function ‘ChatEdit_SendText’
[Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua]:3320: in function <…AddOns/Blizzard_ChatFrameBase/Mainline/
ETC

Unlike typical lua errors related to addons, this one seems to be related to the native Wow’s interface.

Does anyone know how to resolve this?

Regards,
Imm

According to Macro to change spec doesn`t work, the macro should be changed to

/run C_SpecializationInfo.SetSpecialization(1)

Thank you very much!

If you favour clicking a macro to change spec as I do, this might help.

/run local i,s,n=IsMouseButtonDown s=i(2)and 3 or i(3)and 2 or i(5)and 4 or i(1)and 1 if s then _,n=GetSpecializationInfo(s) if n then print((s==GetSpecialization()and"Already "or C_SpecializationInfo.SetSpecialization(s)and"Switching to ")…n) end end

Changes spec depending on how you click the button on the bar:
left button → spec 1,
middle button → spec 2,
right button → spec 3
side button → spec 4.

will work for any class (ie classes without a 3rd or 4th spec) and a give you a reminder if youre already in a spec youre changing into. So you can just have this as a General Macro, and have it on any Chars bars