Project

General

Profile

Hadd » History » Version 6

Per Amundsen, 02/16/2023 12:42 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 6 Per Amundsen
table(ktable).
12
|*Switch*|*Description*|
13
| -b | Indicates &binvar is set. |
14
| -c | Chop the &binvar to first null byte. |
15
| -m | Creates the table if it does not exist. |
16
| -s | Displays the result. |
17
| -uN | Unset the item after N seconds. |
18
| -z | Decreases the item once per second until it reaches zero and then unsets it. |
19 1 Per Amundsen
20
*Parameters*
21
22 6 Per Amundsen
table(ktable).
23
|*Parameter*|*Description*|
24
| <name> | The hash table to add to. |
25
| <item> | The hash table item to add to. |
26
| [text <notextile>|</notextile> &binvar] | The text or &binvar value to add. |
27 1 Per Amundsen
28
*Example*
29
30
<pre>
31
; call the setup once
32
; /abbr_setup
33
;
34
; //echo -a $abbr(lol)
35
;
36
alias abbr_setup {
37
  ;Populate the table, create it if it does not exist.
38
  hadd -m abbr lol laughing out load
39
  hadd abbr omg oh my gosh
40
  hadd abbr lmao laughing my a?? off
41
  hadd abbr brb be right back
42
}
43 2 Per Amundsen
44 1 Per Amundsen
;Get the abbreviation.
45
alias abbr return $hget(abbr, $1)
46
</pre>