$var

From Scriptwiki
Revision as of 20:53, 15 February 2015 by Cail (talk | contribs)

Jump to: navigation, search

Returns information about currently set variables, local or set.

$var(variable name [,N])[.value|.local|.secs]
  • Variable name is a wild card value.
  • N tells us we want the Nth matching variable.
    • N is 0 by default, and therefore can be used to check for existence without it
  • Returns
    • Variable name by default
    • Value if .value is specified
    • If .local is specified, returns $true or $false based on whether or not the matching variable is a local variable

Examples

How to search through local variables only:

var %i = 1
while ($var(%varwildcard*,%i).local) {
  echo -ag $var(%varwildcard*,%i) is a local variable
  inc %i
}

See Also