Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

RestrictedEnvironment

Last wiki revision 2018-11-26

Restricted environment refers to the environment in which restricted addon code (SecureHandler snippets) is executed. A limited subset of the WoW API is available within the environment.

  • ("conditionalString") : parses a macro conditional.
  • : returns current shape shift form.
  • : returns 1 if the player is stealthed
  • ("unit") : returns 1 if the unit exists.
  • ("unit") : returns 1 if the unit is dead.
  • ("unit") : returns 1 if the unit is a ghost.
  • ("unit") : returns 1 if the unit is a player or a pet in your party.
  • ("unit") : returns 1 if the unit is a player or a pet in your raid.
  • ,, : return 1 if the relevant key is held down.
  • ,, : return 1 if the relevant key is held down.
  • ,, : return 1 if the relevant key is held down.
  • : returns 1 if any alt, control or shift key is held down.
  • ("modifierType") : returns 1 if the associated modifier is held down.
  • : returns the mouse button responsible for the hardware click.
  • : returns the current action bar page.
  • : returns the current action bar "bonus" offset (stance-specific bars).
  • : returns 1 if the player is mounted.
  • : returns 1 if the player is swimming.
  • : returns 1 if the player is in a body of water.
  • : returns 1 if the player is flying.
  • : returns 1 if the player is in a flyable area (Northrend, Outland).
  • : returns 1 if the player is indoors.
  • : returns 1 if the player is outdoors.
  • ("key") : returns the action bound to a key.
  • (slot) : returns 1 if an action is placed in the specified action bar slot.
  • (slot[, bookType] or "spellName") : returns 1 if the spell can be cast on hostile targets.
  • (slot[, bookType] or "spellName") : returns 1 if the item can be used on hostile targets.
  • (slot[, bookType] or "spellName") : returns 1 if the spell can be cast on friendly targets.
  • (slot[, bookType] or "spellName") : returns 1 if the item can be used on friendly targets.
  • ("unit") : returns 1 if the player can attack the specified unit.
  • ("unit") : returns 1 if the player can assist the specified unit.
  • : returns 1 if the player is channeling a spell.
  • : returns pet creature family and pet name.
  • : returns 1 if the player or his pet is in combat.
  • : returns "party" or "raid" if the player is in one of those group types.
  • ("unit") : returns 1 if the unit is in a vehicle that provides special UI.
  • (frame, state, conditional) : registers a SecureStateDriver for a specific frame.
  • (slot) : returns limited information about an action in a specific action slot.

Only restricted tables are accessible within the restricted environment -- essentially, the real table instances are kept local to prevent unrestricted access to variables within the restricted environment. Most table functions within the restricted environment have been replaced by restricted table-aware versions, with the exception of the function (use the restricted table-aware instead of table lookup functionality is desired).

The following table-related functions are usable inside the restricted environment:

Note that as the restricted environment doesn't contain proper function references, table.sort's second argument (comparison function) may not be used from within the restricted environment.

The math and string standard library tables are provided in their entirety. The following table lists additional global functions that are also available in the restricted environment

Real frame userdata values cannot exist within the restricted environment. Frame references called frame handles are used instead, supporting a limited number of methods listing below. Snippets initially have access to frame handles of the frame they're running for (as ) and the frame that owns the restricted environment the snippet is executing in (as ). Additional frame handles may be introduced into the restricted environment via the frame:("name", frame) API from insecure code, and retrieved by the snippet using the handle:GetFrameRef("name") method.

Prior to Patch 4.0.1, a special handle existed to allow snippets to call other snippets. This functionality has since been migrated to general frame handles; the handle remains as an alias for.

Only methods marked with a star (*) may be called on references to non-protected frames.

Source

https://warcraft.wiki.gg/wiki/RestrictedEnvironment · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.