mIRC Home    About    Download    Register    News    Help

Print Thread
#213733 07/07/09 09:03 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
If you /hmake a hash table with a name of more than 256 (2^8) chars, the tablename is truncated silently. I think it should throw an $error.
This limit is not imposed by mIRC itself I suppose (?), but 256 is far from the limit I expected (viz. the "usual", internal ~4100) and other length limitations do throw an error if they're hit.

(This may as well be a feature suggestion)

Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
While we're picking on mostly meaningless things:
/hmake -s <name> <N>
Quote:

Creates a new hash table with N slots.

A hash table can store an unlimited number of items regardless of the N you choose, however the bigger N is, the faster it will work, depending on the number of items stored.


I quickly worked out that the reason my hashtable wasn't loading up was because it was trying to initialise with a quite large value.

Code:
/hmake test 10240


Joined: Nov 2006
Posts: 1,559
H
Horstl Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
But this one trows at least some error...
I wasn't able to figure out my issue "quickly" in a scenario of several, dynamically named hash tables and (apparently) random cases where a /h* or $h* applied to- or returned from the (apparently) wrong table (some of my tables turned out to be in fact one table; the truncation applies to all /h* and $h*). Took me awhile. smile
Attempts to use a long tablename may be less frequent, but they ain't improbable... All works as expected as long as your tablenames differ "left" of the truncation point. I think several scripters don't even know that this or that tablename is cropped.
I now of the limit by now, but other scripters will stumble across the same issue, and I think they would appreciate some error message or - as an alternative - a note in the helpfile (a new $error could actually break scripts that work fine with truncated tablenames).

Last edited by Horstl; 08/07/09 05:01 PM.
Joined: Jul 2006
Posts: 3,945
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,945
The 'quite often used' command /echo without parameter does not report any error message too, and noone seems to care frown


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Except it's not an "error", it's simply a truncation. Errors usually mean "something unrecoverable happened"-- in this case, nothing really went wrong, the table was in fact created, it's just only using 256 characters of your input-- you don't need an error to know this will happen (documentation would be nice though). This works the same way the IRC server will accept a long /nick command without any errors but silently truncate it. If that is acceptable behaviour, I don't see why this is not.

I think you just need to be aware that your table names will have a limit of 256 chars and it's up to you to make sure you're under the limit otherwise expect your name to be truncated. The truncation happens across all hash table commands, so it should never affect any scripts unless you had 2 table names with the same first 256 characters, but raising an $error would not fix that problem-- you'd need better names.

All that really needs to happen is to have this documented.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jul 2006
Posts: 3,945
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,945
I think the point was :
Quote:
I wasn't able to figure out my issue "quickly" in a scenario
Since I've myself seen some cases where an error message would have helped me to quickly find a error, I think it's would be a good idea to add a 'prevent message' if mirc truncate the hash table name.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
So add yet another option in mIRC's already-bloated option dialogs to disable an error message for the one uncommon scenario where a user tries to use hash tables with table names that are over 256 characters?

Somehow that sounds like overkill to me.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jul 2006
Posts: 3,945
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,945
Nope, you would just hide the message using un . in front of the /hmake command (or /hadd -m).


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
I think there's a difference in whether a network or mIRC truncates. According to this reasoning there should be no "Line too long" errors either, mIRC could simply chop.

Joined: Aug 2006
Posts: 183
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
If nothing else, a quick sentence in the help file t explain this would be very very helpful.


Yar

Link Copied to Clipboard