Project

General

Profile

$var » History » Version 6

Per Amundsen, 11/03/2020 06:15 AM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$var(%var,[N])*
4
5
Returns the Nth matching variable name.
6
7 5 Per Amundsen
_Searches both local and global variables, [[Scripting_Wildcards|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 6 Per Amundsen
.unset - Number of seconds until the variable is unset (if autounset is on).
20 1 Per Amundsen
21
*Examples*
22
23
<pre>
24 4 Per Amundsen
; Create a variable.
25 1 Per Amundsen
/set %Example Hello World
26
27 4 Per Amundsen
; Print number of variables matching '%Example*'.
28 1 Per Amundsen
//echo -ag $var(%Example*, 0)
29
30
; Print the name and value from the first match.
31
//echo -ag $var(%Example*, 1) = $var(%Example*, 1).value
32 2 Per Amundsen
33
; Delete the variable
34
/unset %Example
35 1 Per Amundsen
</pre>