Project

General

Profile

Actions

Hinc » History » Revision 4

« Previous | Revision 4/5 (diff) | Next »
Per Amundsen, 12/14/2019 09:39 AM


Added in 1.9.0

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

Increases the value of the item by 'num'.

Switches

-b - Indicates &binvar is set.
-c - Chop the &binvar to first null byte.
-m - Creates the table if it does not exist.
-s - Displays the result.
-uN - Unsets the item after N seconds.
-z - Decreases the item once per second until it reaches zero and then unsets it.
-B - Performs a $calcint calculation instead of regular $calc when arithmetic operators are used. (AdiIRC only)

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

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
}

Updated by Per Amundsen about 5 years ago · 4 revisions

Also available in: PDF HTML TXT