AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help]CellTrie (https://forums.alliedmods.net/showthread.php?t=144094)

Lightokun 11-28-2010 20:01

[Help]CellTrie
 
So, i have arrays "ArrayCont","ArrayData"
I put in ArrayData key, like:
Code:

TrieSetCell(ArrayData, "key", 123);
Then i put ArrayData in ArrayCont:
Code:

TrieSetCell(ArrayCont, "some_key", ArrayData);
What happens when i try to rewrite a key in ArrayData, like this?
Code:

new AD
TrieGetCell(ArrayCont, "some_key", AD)
TrieSetCell(AD, "key", 321);

It will add a new key and there will be two keys "key" or it'll rewrite "key" value "123" to value "321"?

fysiks 11-28-2010 21:03

Re: [Help]CellTrie
 
Why don't you just try it out?

Lightokun 11-28-2010 21:15

Re: [Help]CellTrie
 
TrieGetCell(AD, "key", keyvalue);
Returns value of keyvalue, so i guess it rewrites the value. But i don't know for real and i don't know how to check it.

fysiks 11-28-2010 22:05

Re: [Help]CellTrie
 
I'm quite sure it's not possible to have two keys that are identical in the same Trie.

Exolent[jNr] 11-28-2010 22:13

Re: [Help]CellTrie
 
I didn't understand one thing you were trying to do.
Quote:

Originally Posted by Lightokun
So, i have arrays

Tries are not arrays.
If you say you have arrays, we assume they are cellarrays or normal arrays.
Also, Trie handles need to be tagged with Trie.

If you are going to ask if your code works, we are going to say test yourself.
If you need help coding something, then post.

Lightokun 11-28-2010 22:19

Re: [Help]CellTrie
 
Quote:

Originally Posted by Exolent[jNr] (Post 1359254)
I didn't understand one thing you were trying to do.

Tries are not arrays.
If you say you have arrays, we assume they are cellarrays or normal arrays.
Also, Trie handles need to be tagged with Trie.

If you are going to ask if your code works, we are going to say test yourself.
If you need help coding something, then post.

Meh, nevermind. It's deep morning here and i'm in editor for ~7 hours, so i can do mistakes.
The question was how function handles some queryes, if it was posted somewhere i wouldn't ask here.
SetCell/String rewrites keys values. Thx for help.

ConnorMcLeod 11-29-2010 01:10

Re: [Help]CellTrie
 
A key is unique.


All times are GMT -4. The time now is 11:21.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.