Project

General

Profile

$var » History » Revision 5

Revision 4 (Per Amundsen, 02/26/2017 06:54 PM) → Revision 5/8 (Per Amundsen, 05/24/2018 10:11 AM)

_Added in 1.9.0_ 

 *$var(%var,[N])* 

 Returns the Nth matching variable name. 

 _Searches both local and global variables, [[Scripting_Wildcards|wildcards]] wildcards can be used._ 

 *Parameters* 

 %var - Variable to match. 
 [N] - If N = 0, number of matched variables (default), otherwise the Nth match. (optional) 

 *Properties* 

 .value - The variable value. 
 .local - [[$true]] if the variable is a local variable, otherwise [[$false]]. 
 .secs - Number of seconds until the variable is unset (if autounset is on). 

 *Examples* 

 <pre> 
 ; Create a variable. 
 /set %Example Hello World 

 ; Print number of variables matching '%Example*'. 
 //echo -ag $var(%Example*, 0) 

 ; Print the name and value from the first match. 
 //echo -ag $var(%Example*, 1) = $var(%Example*, 1).value 

 ; Delete the variable 
 /unset %Example 
 </pre>