Hash table item(s) info

By Kyousoukyoku on Oct 17, 2007

In code instruction provided. Paste in remotes.

/*
Documentation;
Snippet;Hash item(s) info
Author;Kyou./XN.
Released;10/17/07
***************************
Code that displays the Nth item info in a hash table. Pretty sweet for claiming the info on a certain item in a hash table. Practically a mini-hash viewer. You also have the option to view all items in the table with their data. However, this snippet does not include editing/adding/removing capabilities. 
Syntax: /HASHITEMDISP. (hash table name) (N) N returns the specified line in the hash table. You will receive an error echo if you do not specify proper syntax. -- EX: /HASHITEMDISP. testhashtable 1 - returns the 1st item in a hash table with the line number, the hash table name, the item name, and the item data.  -- -- EX: /HASHITEMDISP. testhashtable all - creates a new window with all the hash table items and their data. Displayed in a (hash item name) - (hash data) format. 
Any redistribution of this or any other scripts made by Kyousoukyoku/XteNsion is forbidden without prior consent of the author. Thanks - Kyou./XN.
*/

ALIAS HASHITEMDISP. { 
  if ($1 && $HGET($1) && $2) { 
    IF ($2 = all) { 
      IF ($WINDOW(HASHVIEW)) { CLEAR @HASHVIEW }
      ELSE { WINDOW -LK @HASHVIEW }
      VAR %X = 1
      WHILE ($HGET($1,%X).ITEM) { 
        ALINE -P @HASHVIEW $V1 - $HGET($1,%X).DATA
        INC %X 
      } 
    }
    ELSEIF ($2 ISNUM) { ECHO $COLOUR(INFO) Hash table: $qt($1) >> Item Num: $qt($2) >> Item name: $qt($HGET($1,$2).ITEM) >> Item data: $qt($HGET($1,$2).DATA) }
  }
  ELSE { 
    ECHO $COLOR(INFO) -A Invalid syntax ; Correct format ; /HASHITEMDISP <HASH TABLE NAME> <ITEM NUMBER OR ZERO> 
  }
}

Comments

Sign in to comment.
Kyousoukyoku   -  Oct 17, 2007

rofl. Nah that was on purpose. ;)

 Respond  
guest598594   -  Oct 17, 2007

U FORGOT TO TURN CAPS LOCK OFF :)

 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.