Hadd » History » Version 5
  Per Amundsen, 01/04/2019 09:20 PM 
  
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ | 
|---|---|---|---|
| 2 | |||
| 3 | 5 | Per Amundsen | */hadd [-bcmsuNz] <name> <item> [text | &binvar]* | 
| 4 | 1 | Per Amundsen | |
| 5 | 5 | Per Amundsen | Adds an item to an existing hash table. | 
| 6 | |||
| 7 | _See also [[/hsave]], [[/hload]], [[/hmake]], [[/hfree]], [[/hdel]], [[$hget]], [[$hfind]]._ | ||
| 8 | |||
| 9 | 1 | Per Amundsen | *Switches* | 
| 10 | |||
| 11 | 3 | Per Amundsen | -b - Indicates &binvar is set. | 
| 12 | 1 | Per Amundsen | -c - Chop the &binvar to first null byte. | 
| 13 | -m - Creates the table if it does not exist. | ||
| 14 | -s - Displays the result. | ||
| 15 | -uN - Unset the item after N seconds. | ||
| 16 | -z - Decreases the item once per second until it reaches zero and then unsets it. | ||
| 17 | |||
| 18 | *Parameters* | ||
| 19 | |||
| 20 | <name> - The hash table to add to. | ||
| 21 | <item> - The hash table item to add to. | ||
| 22 | [text | &binvar] - The text or &binvar value to add. | ||
| 23 | |||
| 24 | *Example* | ||
| 25 | |||
| 26 | <pre> | ||
| 27 | ; call the setup once | ||
| 28 | ; /abbr_setup | ||
| 29 | ; | ||
| 30 | ; //echo -a $abbr(lol) | ||
| 31 | ; | ||
| 32 | alias abbr_setup { | ||
| 33 | ;Populate the table, create it if it does not exist. | ||
| 34 | hadd -m abbr lol laughing out load | ||
| 35 | hadd abbr omg oh my gosh | ||
| 36 | hadd abbr lmao laughing my a?? off | ||
| 37 | hadd abbr brb be right back | ||
| 38 | } | ||
| 39 | 2 | Per Amundsen | |
| 40 | 1 | Per Amundsen | ;Get the abbreviation. | 
| 41 | alias abbr return $hget(abbr, $1) | ||
| 42 | </pre> |