Open main menu
Home
Random
Log in
Settings
About AddOn Studio
Disclaimers
AddOn Studio
Search
Editing
WoW:API issecurevariable
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{wowapi}}__NOTOC__ Determines if given variable or table is [[secure]] or "[[Tainted (Addons)|tainted]]." Any usage of a "[[Tainted (Addons)|tainted]]" (= non-secure) variable, be it a function or simply data, will break [[secure]] state and prevent further access to Protected functions. isSecure, taint = issecurevariable([table], variable) ==Returns== ;isSecure : "boolean" flag: 1 if variable is secure, nil if it is tainted. ;taint : string: addon that tainted the variable (possibly nil if not tainted by an addon). ==Example 1== local secure = issecurevariable( "JumpOrAscendStart" ); if secure then DEFAULT_CHAT_FRAME:AddMessage("OK! Given variable is secure!"); else DEFAULT_CHAT_FRAME:AddMessage("Given variable tainted. :s"); end ===Result=== *[[API_JumpOrAscendStart|JumpOrAscendStart]] is a protected Blizzard-defined function, thus secure. Calling it will not break secure status. *Message "OK! Given variable is secure!" will get displayed in your chat frame. ==Example 2== local Old_UnitName = UnitName function UnitName(unit) return Old_UnitName(unit or "player") end local secure = issecurevariable( "UnitName" ); if secure then DEFAULT_CHAT_FRAME:AddMessage("OK! Given variable is secure!"); else DEFAULT_CHAT_FRAME:AddMessage("Given variable tainted. :s"); end ===Result=== * [[API_UnitName|UnitName]] is not a protected Blizzard-defined function, but will still become tainted when hooked. * Message "Given variable tainted. :s" will get displayed in your chat frame. ==Notes== * Returns <code>1, nil</code> for undefined variables. This is because an undefined variable is secure since you have not tainted it. * Returns <code>1, nil</code> for all untainted variables (i.e. Blizzard variables). * Returns <code>nil</code> for '''any''' global variable that is hooked insecurely (tainted), even unprotected ones like [[API UnitName|UnitName()]]. * Returns <code>nil</code> for all user defined global variables. * If a table is passed first, it checks table.variable (e.g. <code>issecurevariable(PlayerFrame, "Show")</code> checks PlayerFrame["Show"] or PlayerFrame.Show (they are the same thing)). * Does not work for local variables.
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Apinav
(
edit
)
Template:Editlink
(
edit
)
Template:Tocright
(
edit
)
Template:Wowapi
(
edit
)