mIRC Homepage
Posted By: HorseC 4,096 length of item in hash table - 19/01/12 10:04 AM
while this may seem long enough for most, there is a situation where this is NOT long enough.. While i can create multiple items, I am wondering why that limitation is used. (yes, hash tables do take up memory, but that is NOT an issue).

Thanks for any replies.
Posted By: Loki12583 Re: 4,096 length of item in hash table - 19/01/12 02:07 PM
I see no such limit practically or in any documentation.

Code:
alias a {
  bset &b 5000 1
  hadd -mb table item &b
  echo -ag $hget(table,item,&c)
  echo -ag $bvar(&c,0)

  echo -ag -
  var %v = $+($str(0,4100),1)
  hadd -m table item2 %v
  echo -ag $hget(table,item2)
  
  hadd -m table %v 1
  echo -ag $hget(table,%v)
}
Posted By: argv0 Re: 4,096 length of item in hash table - 20/01/12 12:28 AM
The limit is not in the hash tables themselves, it's in how long a /command (and arguments) line can be. The limit is ~4kb, which means hash tables are limited by association, not by design. This also means that the behaviour cannot change (not just for hash tables anyway), nor is it only an issue for hash tables. It affects all commands and is an inherent limitation in the language.

Note that this limit only applies to the buffer length of a command. You can still store as much data as you want inside of a bvar, and then store that bvar in a hash table.

Posted By: argv0 Re: 4,096 length of item in hash table - 20/01/12 12:29 AM
You didn't try hard enough:

Code:
var %v = $+($str(0,4200),1)
; you won't even get to this line
hadd -m table item2 %v
echo -ag $hget(table, item2)
© mIRC Discussion Forums