Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

Verification:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
What is the last letter in the word "SlickEdit":
How many LETTERS are in the following? "a1b2c3":
Which number is missing?  "12345689":

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: Clark
« on: September 07, 2016, 03:26:09 AM »

To avoid adding entries to a hash table, use the _indexin() method.

if (hashtab._indexin('abc') && hashtab:['abc']==null) ...
Posted by: jporkkahtc
« on: September 06, 2016, 06:43:33 PM »

Yes, but when you do that it creates new entries in the hash table.
Just doing this:
if (Linjer:["foo"] == null)
will insert a null "foo" entry and increase the size of the hashtable by 1.

Posted by: Bamsen
« on: September 06, 2016, 07:35:47 AM »

From one of my scripts:
Code: [Select]
if (Linjer:[sTemp] == null) { Linjer:[sTemp]=AddValue; } else { Linjer:[sTemp]+=AddValue; }
This creates the hash variable with a specific value if it does not exist.
If it does exist, it adds the value to the existing one.
Posted by: jporkkahtc
« on: September 06, 2016, 01:45:51 AM »


Can you explain how Slick manages hashtables and arrays?




How do you ask if a hashtable has a specific entry without creating the entry?
What is the difference between a "null" object and an "_isempty" object?




&s_nameIndex:["Two"]
returns a pointer to the "Two" element - fine.
But, what about when you look up elements that don't exist?

 
&s_nameIndex:["Four"]

In the debugger, when this statement is executed s_nameIndex grows from 3 to 4 elements.
The new element is shown as "null", yet what is the thing returned by taking the address of a "null" object?
Even though the debugger shows the entry in the hashtable as null, when I reference it it seems like an object because the pointer doesn't compare= to null, but it _isempty() is true.




Whereas this statement

 
    NameIndex *x = &s_nameIndex._el("Four"); x->m_name="newName"; 

Apparently allocates a NameIndex - as the entry in the hashtable changes from null to a valid NameIndex.


See the attached code.