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