Project

General

Profile

$hget » History » Revision 7

Revision 6 (Per Amundsen, 01/04/2019 09:20 PM) → Revision 7/9 (Per Amundsen, 02/12/2021 06:43 AM)

_Added in 1.9.0_ 

 *$hget(name|N)* 

 Returns name of a hash table if it exists, or returns the name of the Nth hash table. 

 _See also [[/hsave]], [[/hload]], [[/hmake]], [[/hfree]], [[/hdel]], [[$hfind]]._ 

 *Parameters* 

 name|N - Name of the hashtable or If N = 0, number of hashtables, otherwise the Nth hashtable name. 

 *Properties* 

 .size - Returns the size of the hashtable as specified in [[/hmake]]. 

 *Example* 

 <pre> 
 ; Create a hashtable. 
 /hmake Example 

 ; Print number of hashtables. 
 //echo -ag $hget(0) 

 ; Print name and size of the first hashtable. 
 //echo -ag $hget(1) - $hget(1).size 
 </pre> 

 ----------------------------------------------------------------------------- 

 *$hget(name|N, item|N, [&binvar])* 

 Returns the data associated with an item in the specified hash table. 

 *Parameters* 

 name|N - Name of the hashtable or the Nth hashtable name. 
 item|N - Name of the item or if N = 0 number of items, otherwise the Nth item. 
 [&binvar] - Assigns the contents of the item to a &binvar. (optional) 

 *Properties* 

 .data - Returns the item value. 
 .item - Returns the item name. 
 .unset - Returns number of seconds before the item is automatically removed (if set). 
 .hash - TODO 
 .state - TODO 

 *Example* 

 <pre> 
 ; Create a hashtable 
 /hmake Example 

 ; Add a item to the hashtable 
 /hadd Example ExampleItem ExampleValue 

 ; Print number of items in the hastable. 
 //echo -ag $hget(Example, 0) 

 ; Print information about the first item in the hashtable. 
 //echo -ag Name is $hget(Example, 1).item Value is $hget(Example, 1).data Unset at $hget(Example, 1).unset 
 </pre>