[Plugin] Hash table

0 favourites
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hi,

    I sent you a private message regarding this.. but this would be better to answer this here since it could help someone else with the same kind of problem.

    How much flexible is your plugin (in term of accessing multi-level JSON and arrays)? I am exchanging data between a WebSocket server in this format..

    OpCode-Token { ... }

    The end is obviously JSON data. So would it be better to fully handle nested-levels JSON with your plugin (if its flexible enough).. or use your plugin to only parse the first level and prepare the c2array or c2dictionnary JSON directly on the server-side so i end up with..

    1-1234 {"valueA":123, "data":{"c2array":true, "size":[3,1,1], "data":[[[0]],[[1]],[[2]]]}}

    so all i could do in this case is getting data with your plugin and load it to the array. But at the expanse of bandwidth!

    Thanks!

  • EDIT:IGNORE THIS

    Hi Rex,

    I prefer Hashtable format because its doesn't prepend "c2Dictionary" to the JSONs unlike dictionary. I can map hashtable directly onto JS object representation for Firebase JSON store. Its very nice.

    However, it doesn't seem to support containers, which is necessary to support lists of players (each with their own hashtable).

    Any motivation to support this C2 feature? Or shall I get hacking?

    Tom

    EDIT: weird, it seems to be working now without me changing anything... I am confused.com

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Update:

    Add "action:pick keys", to pick keys into an array object. See sample capx.

    This action will set array size to (0,1,1), then push keys into array. Using "array condition: for each element X" to pick them.

    Hey rex,

    I cannot seem to get your example capx for pickkeys to work properly. Do you know if something changed in Construct that would undo your plugin's pickkeys method?

    Thanks,

    gumshoe

  • gumshoe2029

    Uh, it's a bug, I had fix it. Try to download plugin again.

    capx

  • gumshoe2029

    Uh, it's a bug, I had fix it. Try to download plugin again.

    capx

    Beautiful, it works flawlessly now, thanks!

  • Hey Rex,

    just a simple question:

    I have very complex JSON structures and wanted to loop my results in a foreach. But then I saw, that you restricted "For Each"-Condition to strings and numbers. (In my case it was just a multidimensional json structure, so ForEach had to handle an object). I removed the line where you checked the type and everythings working very smoothly (for almost a year now).

    Just wanted to know your opionion why you restricted for each loops Thanks.

    P.S.: I love this plugin!! I couldn't imagine working without it!

  • Vuuv

    It's because that I will pick the value for expression.

    There is another plugin for json structure made by Yann. You could try it.

  • So, I am having an issue with a click event in a project I am working on. When a user clicks an object, with a unique set of properties, they are supposed to be sent to another layout and the client makes a call to the server. Then, depending on what object was clicked, a hash table is loaded from the JSON string and that object's respective properties are placed into variables and put inside the Hash, where they are then placed into an array object using "pick keys "" into (nondescript array goes here)". But I'm having a problem getting it to work correctly. While the layout that is supposed to open does so, and error is thrown. This is the error message:

    Javascript error!

    SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data, line 234 (col undefined)

    I'm not exactly sure what is wrong and would appreciate some input.

    Thanks!

  • And I just realized that I'm not permitted to post URLS because I don't have enough rep, so you can't see the URL that was in the error message. Great. Haha.

  • Please tell me how to use this plugin to read json in hashtable.....I did one thing. ....I loaded Ajax.lastdata with json string then I used load hashtable with string property and loaded ajax.lastdata in it.....Nothing happened.....Please tell me the right way to use this.....

  • chinmay

    Yann's JSON plugin might be more powerful then mime. You could try it.

  • Hi......Sorry I parsed one row.....perfect....But is it possible to parse multiple rows.....Like if I want to parse:

    [{"id":23,"firstName":"Meghna","lastName":"Naidu","email":"meghna@gmail.com","phone":"8978767878"},{"id":3,"firstName":"Robert","lastName":"Parera","email":"robert@gmail.com","phone":"8978767878"},{"id":93,"firstName":"Andrew","lastName":"Strauss","email":"andrew@gmail.com","phone":"8978767878"},{"id":239,"firstName":"Eddy","lastName":"Knight","email":"knight@gmail.com","phone":"7978767878"}]..........

    Is it possible to parse all these rows?

  • chinmay

    Try remove new line at each line end in your case.

  • what is your hash tables algorithm complexity for insert/remove/read(search/find)?

  • what is your hash tables algorithm complexity for insert/remove/read(search/find)?

    Sorry, I don't know. It uses javascript's object (hash table) feature.

    Here is another JSON plugin which had more complete functions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)