ScriptRegion:GetSourceLocation

From Warcraft Wiki
Jump to navigation Jump to search

Returns the script name and line number where the region was created.

location = ScriptRegion:GetSourceLocation()

Returns

location
string - The script name and line number where the region was created.

Details

  • The returned string will be the script name and line number delimited with a colon, eg. path\to\script.lua:10.
  • For accurate script names the enableSourceLocationLookup console variable must be set to 1, otherwise the script name will always be "UnknownFile".
  • For dynamically loaded scripts the script name portion will correspond to the chunkname argument supplied to loadstring. If not supplied, this will typically expand to a leading portion of the script body.
  • Texture and fontstring regions created through script APIs at-present report the source location of their initial parent frame, whereas those created statically in XML will be correct.

Patch changes

Shadowlands Patch 9.2.5 (2022-05-31): Added.