mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hello,

I couldn't find any reference material on the net,

on how to re-write or change an item / data in a hash table.

Can this be done? If so how?

Thanks in advance

Cheers,

Jay.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
The same way you wrote to it in the first place:
/hadd <table> <item> <data>


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Or I suppose you can use /hdel to get rid of the previous entry and then overwrite with a new set of item and data:

Code:
alias rewrite {
  if (!$hget(Test)) hadd -m Test 1 2
  hdel -sw Test 1 2
  hadd Test 3 4
  hdel -sw Test 3 4
  hadd Test 5 6
}

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You could, but why you would want to when using the /hadd command over-writes the previous entry, I have no idea.

Also noticed the following:
1) The s switch displays the results in the status window
2) The w switch makes the /hdel work with wildcards, which are non-existant in your code.
3) Only the table name and item are required for /hdel (eg:
Code:
/hdel Test 1
works perfectly fine)

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Quote:
1) The s switch displays the results in the status window


I beg to differ, RusselB. The -s switch makes the hash tables display the result according to the help file.

But you may be right, because it does show in the active window instead of the status, though.

Last edited by Tomao; 07/11/08 05:04 AM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You may be correct, I usually have the status window as the active window when testing things like that, so the s switch would've showed in the status window in my case.

Still seems foolish to have the result displayed when using the /hdel command, as you are deleting the entry, therefore the displayed result would be unnoticeable (ie: $null)

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I believe '-s' in this sense means 'show' and not status.

As far as I know Khaled only explained this switch in the variables section of the help file.


Quote:
Note: You can use /var -s to make a variable show the result when a value is set, and /var -g to set a global variable.


Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Thank you so much everyone for helping me.

I didnt realiase it was that easy to overwrite an existing entry in a hash table.

Cheers,

Jay.

Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Thank you so much everyone for helping me.

I didnt realiase it was that easy to overwrite an existing entry in a hash table.

Cheers,

Jay.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Quote:
as you are deleting the entry, therefore the displayed result would be unnoticeable (ie: $null)


First of all, thanks DJ_Sol for the clarification of the -s switch in the hash tables.

To RusselB, it shows the result of a deleted item in the hash tables. So it's not a $null.

/hdel -s Test 1

*Deleted item '1' from hash table 'Test'

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Tamao, reread what russelb said.

Your example showed:

/hdel table item data


When all you need for /hdel is the table and item.

Thank you for participating!

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Excuse me for misreading Russel's post, and thanks for the lesson learned.

Joined: Jun 2008
Posts: 58
P
Babel fish
Offline
Babel fish
P
Joined: Jun 2008
Posts: 58
Originally Posted By: DJ_Sol
As far as I know Khaled only explained this switch in the variables section of the help file.


What about...

Quote:
The -s switch makes the command display the result.

/help /hmake


Link Copied to Clipboard