Project

General

Profile

$hget » History » Version 4

Per Amundsen, 06/14/2016 08:02 AM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$hget(name|N)*
4
5
Returns name of a hash table if it exists, or returns the name of the Nth hash table.
6
7
*Parameters*
8
9
name|N - Name of the hashtable or If N = 0, number of hashtables, otherwise the Nth hashtable name.
10
11
*Properties*
12
13 3 Per Amundsen
.size - Returns the size of the hashtable as specified in [[/hmake]].
14 1 Per Amundsen
15
*Example*
16
17
<pre>
18
; Create a hashtable.
19
/hmake Example
20
21
; Print number of hashtables.
22
//echo -ag $hget(0)
23
24
; Print name and size of the first hashtable.
25
//echo -ag $hget(1) - $hget(1).size
26
</pre>
27
28
-----------------------------------------------------------------------------
29
30
*$hget(name|N, item|N, [&binvar])*
31
32
Returns the data associated with an item in the specified hash table.
33
34
*Parameters*
35
36
name|N - Name of the hashtable or the Nth hashtable name.
37 2 Per Amundsen
item|N - Name of the item or if N = 0 number of items, otherwise the Nth item.
38 1 Per Amundsen
39
*Properties*
40
41
.data - Returns the item value.
42
.item - Returns the item name.
43
.unset - Returns number of seconds before the item is automatically removed (if set).
44 4 Per Amundsen
[&binvar] - Assigns the contents of the item to a &binvar.
45 1 Per Amundsen
46
*Example*
47
48
<pre>
49
; Create a hashtable
50
/hmake Example
51
52
; Add a item to the hashtable
53
/hadd Example ExampleItem ExampleValue
54
55
; Print number of items in the hastable.
56
//echo -ag $hget(Example, 0)
57
58
; Print information about the first item in the hashtable.
59
//echo -ag Name is $hget(Example, 1).item Value is $hget(Example, 1).data Unset at $hget(Example, 1).unset
60
</pre>