From WikiChip
Difference between revisions of "mirc/commands/hdel"
m (Bot: Adding a template) |
(→See also) |
||
(13 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | The '''/hdel | + | {{mirc title|/hdel Command}} |
− | + | The '''/hdel''' command deletes an item/data-value pair from an existing hash table. | |
== Synopsis == | == Synopsis == | ||
− | /hdel [-sw] <nowiki><table></nowiki> < | + | /hdel [-sw] <nowiki><table></nowiki> <item> |
− | |||
== Switches == | == Switches == | ||
− | * '''-s''' - Displays the | + | * '''-s''' - Displays the Deletion action if the variable exists, displays error if table doesn't exist, no display if the table exists but the item does not. |
− | * '''-w''' - Treats <nowiki><table></nowiki> as a wildcard and deletes all matching tables. | + | * '''-w''' - Treats <nowiki><table></nowiki> as a {{mirc|wildcard}} and deletes all matching tables. |
− | |||
== Parameters == | == Parameters == | ||
* '''<nowiki><table></nowiki>''' - The table which contains the item you are deleting | * '''<nowiki><table></nowiki>''' - The table which contains the item you are deleting | ||
− | * '''< | + | * '''<item>''' - the item-name associated with a value to delete. Can be a {{mirc|wildcard}} when using -w switch. |
− | |||
== Example == | == Example == | ||
<syntaxhighlight lang="mIRC">alias hdel_example { | <syntaxhighlight lang="mIRC">alias hdel_example { | ||
Line 37: | Line 34: | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
+ | <source lang="mIRC"> | ||
+ | //hfree -sw test | hadd -m1 test item1 | hadd test item* | echo -a 1st item is $hget(test,1).item | hdel -w test item* | echo -a there are $hget(test,0).item items remaining | ||
+ | * Demonstrates that an item can be created and deleted containing an asterisk. If the -w switch is deleted, only 1 of the 2 items is deleted because of an exact item-name match with "item*". | ||
+ | |||
+ | //hfree -sw test | hmake -s test | hdel -s test itemname | echo -a message 1 | hfree -s test | hdel -s test itemname | echo -a message 2 | ||
+ | * Demonstrates that deleting a non-existent item from an existing table allows the script flow to continue, but deleting an item from a non-existent table is an error halting the script flow preventing the 2nd message from displaying. | ||
+ | </source> | ||
== Compatibility == | == Compatibility == | ||
− | + | {{mIRC compatibility|5.8}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
== See also == | == See also == | ||
− | * | + | * {{mIRC|/hmake}} |
− | * | + | * {{mIRC|/hfree}} |
− | * | + | * {{mIRC|/hload}} |
− | + | * {{mIRC|/hsave}} | |
− | + | * {{mIRC|/hadd}} | |
− | * | + | * {{mIRC|/hinc}} |
− | * | + | * {{mIRC|/hdec}} |
− | * | + | * {{mIRC|Hash Tables}} |
− | * | + | * {{mIRC|$hget}} |
− | * | + | * {{mIRC|$hfind}} |
− | * | ||
− | {{mIRC | ||
− | |||
− |
Latest revision as of 18:28, 2 May 2023
Commands & Identifiers
Basics
Events
Matching Tools
Data Storage
Control Structures
GUI Scripting
Sockets
Advanced Scripting
Additional Resources
Security
Other
The /hdel command deletes an item/data-value pair from an existing hash table.
Synopsis[edit]
/hdel [-sw] <table> <item>
Switches[edit]
- -s - Displays the Deletion action if the variable exists, displays error if table doesn't exist, no display if the table exists but the item does not.
- -w - Treats <table> as a wildcard and deletes all matching tables.
Parameters[edit]
- <table> - The table which contains the item you are deleting
- <item> - the item-name associated with a value to delete. Can be a wildcard when using -w switch.
Example[edit]
alias hdel_example { ;add items hadd -m example academic a hadd example academy a hadd example accelerate a hadd example accelerator a hadd example accept a hadd example access a hadd example accident a hadd example because b ;number of items echo -a $hget(example, 0).item ;remove everything by one hdel -w example a* ;number of items echo -a $hget(example, 0).item ;free table hfree example }
//hfree -sw test | hadd -m1 test item1 | hadd test item* | echo -a 1st item is $hget(test,1).item | hdel -w test item* | echo -a there are $hget(test,0).item items remaining * Demonstrates that an item can be created and deleted containing an asterisk. If the -w switch is deleted, only 1 of the 2 items is deleted because of an exact item-name match with "item*". //hfree -sw test | hmake -s test | hdel -s test itemname | echo -a message 1 | hfree -s test | hdel -s test itemname | echo -a message 2 * Demonstrates that deleting a non-existent item from an existing table allows the script flow to continue, but deleting an item from a non-existent table is an error halting the script flow preventing the 2nd message from displaying.
Compatibility[edit]
Added: mIRC v5.8
Added on: 05 Sep 2000
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.