Talk:API C CVar.SetCVar

From Warcraft Wiki
Jump to navigation Jump to search

locale

This seems to require a client restart to take effect (not a UI reload).

SetCVar("locale", locale)

Do not overwrite this function!

Do not overwrite this function! You'll have a very hard time finding the reason for those nasty "sry, your addon was blocked cause it called a secure function" errors.

My example: hitting the escape key should just open the game menu. If you overwrite SetCVar you'll get the error each time you press Esc (except when closing a window). The error is released by the Blizzard UI functions API_SpellStopCasting, API_SpellStopTargeting and API_ClearTarget, because they appear in API_ToggleGameMenu. I've got no idea why SetCVar is called between hitting Esc and reaching API_ToggleGameMenu. -- Ohklus

Try doing this to see when and what is happening with this function:
hooksecurefunc("SetCVar", function(a, b, c)
    ChatFrame1:AddMessage(tostring(a) .. ", " .. tostring(b) .. ", " .. tostring(c))
end)

Posted by: EGingell (T|C|F) on 10:40, 22 July 2008 (UTC)