/hview

By Kyousoukyoku on Sep 22, 2007

A simple code that allows you to view the items in a hash table. It gives you the option to delete or add items on free will.

/hview (hash) - lists all items in the table in the new window, giving you the option to remove or add the items
/hview - lists all hash tables, giving you the option to release them or make new ones. ;)

alias hview {
  var %x 1 
  if ($1) {
    if (!$window(hash)) { window -lk @hash }
    elseif ($window(hash)) { clear @hash } 
    while ($hget($1,%x).item) { 
      aline -p @hash $v1
      inc %x
    }
    set %hash $1
  }
  elseif (!$1) { 
    if (!$window(hash_all)) { window -lk @hash_all }
    elseif ($window(hash_all)) { clear @hash_all } 
    while ($hget(%x)) { 
      aline -p @hash_all $v1
      inc %x
    }
  }
}

menu @hash {
  remove:{
    if ($gettok($sline($active, 1),1-,32)) { 
      hdel %hash $v1
      dline @hash_all $sline($active, 1).ln
    }
  }
  add:{ 
    var %hashtemp $?="Enter item name"
    var %hashtemp1 $?="Enter item data"
    if (%hashtemp && %hashtemp1) { hadd %hash %hashtemp %hashtemp1 }
    aline -p @hash %hashtemp 
  }
}

menu @hash_all { 
  free:{
    if ($gettok($sline($active, 1),1-,32)) { 
      hfree $v1
      dline @hash_all $sline($active, 1).ln
    }
  }
  new:{
    var %hashtemp $?="Enter table name"
    if (%hashtemp) {  
      var %hashtemp1 $?="Enter table storage amount"
      if (%hashtemp1) {
        hmake %hashtemp %hashtemp1 
        aline -p @hash_all %hashtemp
      }
    }
  }
}

Comments

Sign in to comment.
Kyousoukyoku   -  Oct 14, 2007

Updated.

 Respond  
Kyousoukyoku   -  Oct 14, 2007

you should be inputting a table name, and it should check but I will update it. =/

 Respond  
guest598594   -  Oct 14, 2007

i get error if i dont input anything into the boxes

make it so it only goes to storage size if i input a table name

var %x = $$?=\"Table Name?\"
if (%x) {
  hmake %x $$?=\"Size?\"
}
 Respond  
Kyousoukyoku   -  Oct 14, 2007

Updated:

/hview (hash) - lists all items in the table in the new window, giving you the option to remove or add the items
/hview - lists all hash tables, giving you the option to release them or make new ones. ;)

 Respond  
guest598594   -  Sep 22, 2007

no im saying list the hash table names

 Respond  
Kyousoukyoku   -  Sep 22, 2007

On the contrary, that isn\'t a bad idea. A dialog might be a lot easier as well and can include thorough options. I\'ll take your advice into consideration. =)

 Respond  
Kyousoukyoku   -  Sep 22, 2007

It already lists the hash tables. I didn\'t use a dialog on this one because it\'s much easier through an alias and simple right-clicks.

 Respond  
guest598594   -  Sep 22, 2007

i think u should make a dialog, and list the hash tables and stuff

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.