WoW:API issecurevariable: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 1: Line 1:
{{wowapi}}__NOTOC__
{{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.
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.


  issecurevariable()
  issecurevariable()

Revision as of 23:29, 14 May 2008

WoW API < issecurevariable

Determines if given variable or table is secure or "tainted." Any usage of a "tainted" (= non-secure) variable, be it a function or simply data, will break secure state and prevent further access to Protected functions.

issecurevariable()

Parameters

Arguments

[table], variable

Return

nil (tainted) or 1 (secure)

Example 1

local secure = issecurevariable( "JumpOrAscendStart" );
if not ( secure == nil ) then 
 DEFAULT_CHAT_FRAME:AddMessage("OK! Given variable is secure!");
else
 DEFAULT_CHAT_FRAME:AddMessage("Given variable is not secure, doing stuff with it will break secure status. :s");
end

Result

  • 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

some_variable_not_defined_by_blizzard = "bla39_j!";
local secure = issecurevariable( "some_variable_not_defined_by_blizzard" );
if not ( secure == nil ) then 
 DEFAULT_CHAT_FRAME:AddMessage("OK! Given variable is secure!");
else
 DEFAULT_CHAT_FRAME:AddMessage("Given variable is not secure, doing stuff with it will break secure status. :s");
end

Result

  • Message "Given variable is not secure, doing stuff with it will break secure status. :s" will get displayed in your chat frame.

Notes

  • Seems to always return 1 for nil variables.