Extension:External Data/Special variables
Appearance
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 __yaml
variables), 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 theXML
format (meaningful only in Lua )__json
- contains the complete JSON structure, forJSON
format (in Lua)__yaml
- contains the complete JSON structure corresponding to the YAML data, forYAML
format (in Lua)__text
- contains the complete text, for thetext
format__comment
- contains any comments from the text, for theINI
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 thedirectory
parameter is used)