Extension:External Data/Special variables

In addition to the standard "local variables" that External Data's functions populate when they retrieve data, there are a number of "special variables" that get automatically populated after certain calls. These variables' names all start with two underscores. In some cases (the __xml, __json and __yamlvariables), their values do not hold text but rather a full object, so they may only be useful when called from within Lua , but they are still available to any code that calls them.


The following variables will get populated with parsed text, i.e. calls that include the |format= parameter:

  • __xml - contains the complete XML structure, for the XML format (meaningful only in Lua )
  • __json - contains the complete JSON structure, for JSON format (in Lua)
  • __yaml - contains the complete JSON structure corresponding to the YAML data, for YAML format (in Lua)
  • __text - contains the complete text, for the text format
  • __comment - contains any comments from the text, for the INI format
  • __start, __end, __lines, __total - contain information about the amount of the original text that was parsed, for use with the |start line=, etc. parameters


Calls to #get_web_data and #get_soap_data will also populate the following variables:

  • __time - contains the time that the data was fetched on, as a Unix timestamp
  • __stale - true, if data could not be fetched, and a stale cache was used; false otherwise
  • __tries - the number of attempts needed to fetch the data


Calls to #get_file_data will populate the following variable:

  • __file - holds the name of the file, relative to the $edgDirectoryPath setting (populated only if the directory parameter is used)