Project

General

Profile

$hget » History » Version 7

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