Hello Daniel,
The readme file or the cookboks don't say anything about this. Can you please enhance the readme? - the indexing: key_name[n] - the array size: key_name::size
Question: can the following syntax be used to delete a specific element in an array key? kamcmd htable.get students anna[2] kamcmd htable.get students anna[0]
Regards, Ovidiu Sas
On Mon, Feb 24, 2014 at 2:52 PM, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
On 22/02/14 22:29, Juha Heinanen wrote:
Ovidiu Sas writes:
I moved the discussion here, in a separate thread. It seems that what are you looking for is not there ... not implemented.
yes, that is way is asked about it.
If you have the same key_name with different values in the table, the last value will be the one loaded in memory. You can't have an array of values for the same keys.
Also, there's no syntax to access a particular value in an array. Maybe that's why there's no option to provide the value.
see this:
o key type - the type of the key
0 - simple key - the key is added as 'key_name'. 1 - array key - the key is added as 'key_name[n]'. n is incremented for each key with this name to build an array in hash table.
for clarifications, this is still a single key item in memory, just its format is made 'key_name[n]'. Hash tables by definition work with unique key indexing.
So adding such items in the hash table should be like:
kamctl mi sht_add ht0 'abc[0]' v0 kamctl mi sht_add ht0 'abc[1]' v1 kamctl mi sht_add ht0 'abc::size' 2
Cheers, Daniel
for example:
$var(size) = $sht(htable=>$var(key)::size); $var(i) = 0; while ($var(i) < $var(size)) { $var(value) = $sht(htable=>$var(key)[$var(i)]); ...
-- juha
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
-- Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda