Project

General

Profile

$var » History » Version 3

Per Amundsen, 02/26/2017 06:54 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$var(%var,[N])*
4
5
Returns the Nth matching variable name.
6
7 3 Per Amundsen
_Searches both local and global variables, wildcards can be used._
8 1 Per Amundsen
9
*Parameters*
10
11
%var - Variable to match.
12
[N] - If N = 0, number of matched variables (default), otherwise the Nth match. (optional)
13
14
*Properties*
15
16
.value - The variable value.
17
.local - [[$true]] if the variable is a local variable, otherwise [[$false]].
18
.secs - Number of seconds until the variable is unset (if autounset is on).
19
20
*Examples*
21
22
<pre>
23
; Create a variable
24
/set %Example Hello World
25
26
; Print number of variables matching '%Example*'
27
//echo -ag $var(%Example*, 0)
28
29
; Print the name and value from the first match.
30
//echo -ag $var(%Example*, 1) = $var(%Example*, 1).value
31 2 Per Amundsen
32
; Delete the variable
33
/unset %Example
34 1 Per Amundsen
</pre>