/hedit or $hedit
A simple alias that edits the data of a specified item in a hash table through hadd and hdel. You must specify all the required parameters otherwise the snippet will not work. See the comments below for more information.
/hmove
Simple alias that copies a hash table into a new one through a really simple method. It stores all the item from the first hash table into a temporary txt file. Then it reads the text file and converts the data from the txt file into the new hash table.
/hpaste
Simple alias that does the same as /hmove but keeps the first table.
;--------------------------------
;--- /hedit - Saeed * 2007 ------
;--------------------------------
;--- Usage ----------------------
;--- /hedit hashname item data --
;--- $hedit(hashname,item,data) -
;--------------------------------
;--------------------------------
alias hedit {
if ($isid) {
if ($hget($1)) {
if ($2) {
if ($hget($1,$2).item) && ($hget($1,$2).data) {
if ($3-) {
hdel $1 $2
hadd $1 $2 $3-
}
}
}
}
}
else {
if ($hget($1)) {
if ($2) {
if ($hget($1,$2).item) && ($hget($1,$2).data) {
if ($3-) {
hdel $1 $2
hadd $1 $2 $3-
}
}
}
}
}
}
;-------------------------------------------
;--- /hmove - Saeed * 2007 -----------------
;-------------------------------------------
;------ Usage ------------------------------
;--- /hmove firsthashname -> newhashname ---
;-------------------------------------------
alias hmove {
if ($1 && $2 && $3) {
if ($hget($1) && !$hget($2)) {
var %x 1
write tmpmoveforhash.txt
while ($hget($1,%x).item) {
write tmpmoveforhash.txt $v1 $hget($1,%x).data
inc %x
}
hmake $2 $3
var %x 1
while ($read(tmpmoveforhash.txt,%x)) {
hadd -m $2 $v1
inc %x
}
hfree $1
remove tmpmoveforhash.txt
}
}
}
Pros:
Cons:
If you included a hash view and(or) editor that would be fantastic. I\'m sorry but right now, these aren\'t too worthy of a high score. My rating: 5.5/10-5.9/10
Indeed, but the purpose and actions /hedit takes is much simpler to use then using hdel and hadd. If I don\'t specify this specific format, it won\'t really edit. I could make the format of /hedit a little different somehow if you would like but right now that is quite necessary. Anything I can improve on in this snippet to make it worth more than a 3.0?