[Plugin] Hash table

Post your completed addons to share with the community

Post » Sat Dec 31, 2011 8:05 am

Hash table plugin, plugin and sampe capx files are included.

Hash table behavior, behavior.
Last edited by rexrainbow on Tue Jun 14, 2016 12:17 pm, edited 2 times in total.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Sat Dec 31, 2011 6:43 pm

Wow thanks for this!! I Tried to call the twitter API, Nothing happened though :( I'll try play around with it some more later :D Thank again!!
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Sun Jan 01, 2012 1:50 am

@smitchell

Can you show an example JSON string and indicate what key you need?
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Mon Feb 27, 2012 1:13 pm

Update:

Add property for initialize hash table data (in JSON string)rexrainbow2012-02-27 13:13:46
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Thu Mar 08, 2012 1:30 am

@rexrainbow
can you explain the difference between Hash.At and Hash.Entry expressions? Also, are all key/value pairs stored as strings?

thanks,
-- cacotigon
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Thu Mar 08, 2012 5:29 am

Key is a string, value can be number or string.

The parameter of "expression:Hash.At" is a fully key string. ex "a.b.c0".

"expression:Hash.Entry" need to used with "action:Set current entry". For example, value in key string "a.b.c0" can spite to "a.b" and "c0".
- Using "action:Set current entry" to set current entry to "a.b"
- Using "expression:Hash.Entry" by "c0"



"expression:Hash.Entry" might make user confused, how about deprecating it?rexrainbow2012-03-08 05:32:24
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Sun Mar 11, 2012 9:40 pm

Hi Rex, some questions about hashtables

is there a way to loop thru a hashtable or should i combine it somehow with an array

and is a hashtable a good way to do something like a shop with tabs :

example:

armortab:
heavy armor = properties: defence:4 attack:0
medium armor = properties: defence:2 attack:0
...
weaponstab:
sword = prop: def:1 atk:6
dagger= prop: def:0 atk:2
...

how would i write something like this?

{"armor"{"heavy_armor"{"def":4}, "medium_armor"{"def":2,"atk":2} }, "weapons "{"sword"{"def":1,"atk":6} "dagger"{"def":0,"atk":2}           }}
?
thanx for any advice you can give..
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Sun Mar 11, 2012 11:44 pm

@vtrix

If you want to set some initial definition, try CSV plugin. You can create readable table in excel (or something else)

I'll try to implement "loop thru a hashtable". BTW, CSV has a loop retrieve condition.rexrainbow2012-03-11 23:46:42
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Mon Mar 19, 2012 12:20 am

Update:

Add version to 0.5
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Mon Apr 16, 2012 12:47 am

Update:

Add condition: for each. expression: CurKey, CurValue

For example, hash table =
[code]{
"a":{
       "b":1,
       "c":2
     },
"d":3
}[/code]

for each "a" will get
key = "b" , value = 1
key = "c" , value = 2

for each "" ("" is root) will get
key = "d" , value = 3
( There are two keys "a" and "d" in root, but value at key "a" is not a number or string, only get key "d")rexrainbow2012-04-16 01:08:18
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Next

Return to Completed Addons

Who is online

Users browsing this forum: gamecorpstudio, X3M and 0 guests