Project

General

Profile

Hinc » History » Revision 2

Revision 1 (Per Amundsen, 02/11/2014 07:59 PM) → Revision 2/5 (Per Amundsen, 02/11/2014 08:03 PM)

_Added in 1.9.0_ 

 */hinc [-bcmsuNz] <name> <item> [num | &binvar]* 

 Increases the value of the item by 'num'. 

 *Switches* 

 -b -s - indicates &binvar is set. 
 -c - chop displays the &binvar to first null byte. result. 
 -m - creates the table if it does not exist. 
 -s -b - displays the result. indicates binvar is set. 
 -uN -c - unsets chop the item after N seconds. binvar to first null byte. 
 -z - decreases the item once per second until it reaches zero and then unsets it. 
 -uN - unsets the item after N seconds. 

 *Parameters* 

 <name> - The hashtable where the <item> is stored. 
 <item> - The hashtable item to increase. 
 [num | &binvar] - The number or &binvar to increase by. 

 *Example* 

 <pre> 
 alias example { 
   ;Create a hashtable. 
   /hmake -s example 
 
   ;Add a few items. 
   /hadd example item1 4 
   /hadd example item2 7 
   /hadd example item3 9 
 
   ;Print the items. 
   /echo -a item1 = $hget(example, item1) 
   /echo -a item2 = $hget(example, item2) 
   /echo -a item3 = $hget(example, item3) 
 
   ;Increase the values. 
   /hinc example item1 5 
   /hinc example item2 12 
   /hinc example item3 1 
  
   /echo -e - 
 
   ;Print the items. 
   /echo -a item1 = $hget(example, item1) 
   /echo -a item2 = $hget(example, item2) 
   /echo -a item3 = $hget(example, item3) 
 
   ;Cleanup. 
   /hfree -s example 
 } 
 </pre>