OK, back to the topic...
In this post I would like to show exactly how these commands would function for anyone interested...
You can use these aliases until they are implemented as internal commands.
Advanced Users and/or Anyone not interested in these commands, may simply disregard this post.
Note that while these aliases function perfectly they are not nearly as efficient as built-in commands.
Also I am aware that using /hsave and /hload instead of while loops may be more efficient, however that method doesn't work properly in certain situations.
These aliases include error handling.
Command: /hren
Info: Renames hash tables or hash table items.
Syntax: /hren <table> [item] <new name>
alias hren {
if (!$2) echo $color(info) -ae * /hren: insufficient parameters
elseif (!$hget($1)) echo $color(info) -ae * /hren: no such table $+(',$1,')
elseif ($3) {
if (!$hfind($1,$2)) echo $color(info) -ae * /hren: no such item $+(',$2,')
else {
hadd $1 $3 $hget($1,$2)
hdel $1-2
}
}
elseif ($2) {
var %a = $hget($1,0).item
hmake $2 $hget($1).size
while (%a) {
hadd $2 $hget($1,%a).item $hget($1,%a).data
dec %a
}
hfree $1
}
}
Command: /hcopy
Info: Copies hash tables or hash table items.
Syntax: /hcopy <table1> [item1] <table2> [item2]
alias hcopy {
if (!$2) echo $color(info) -ae * /hcopy: insufficient parameters
elseif (!$hget($1)) echo $color(info) -ae * /hcopy: no such table $+(',$1,')
elseif ($3) {
if (!$hfind($1,$2)) echo $color(info) -ae * /hcopy: no such item $+(',$2,')
elseif ($4) hadd -m $3-4 $hget($1,$2)
else hadd -m $3 $2 $hget($1,$2)
}
else {
var %a = $hget($1,0).item
if (!$hget($2)) hmake $2 $hget($1).size
while (%a) {
hadd $2 $hget($1,%a).item $hget($1,%a).data
dec %a
}
}
}