[Solved] can't use JsonObject.All, don't understand Iterators

About Monkey 2 Forums Monkey 2 Programming Help [Solved] can't use JsonObject.All, don't understand Iterators

This topic contains 4 replies, has 3 voices, and was last updated by  abakobo 1 year, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #11678

    abakobo
    Participant

    I’m trying to use the JsonObject.All method but can’t.
    In the docs it says it returns an iterator but when trying to “for eachin” it, the compiler tells me it has no “atEnd” method.
    So I checked Map.Iterator struct and yes it doesn’t have an “atEnd” method! is it normal? Some others iterators (stack for example) does have an “AtEnd” method.

    I can use eachin loops with a map getting it’s nodes within the for loop. But I actually don’t know what to do with an iterator!
    I am supposed to use iterators as a end user? Am I supposed to use the JsonObject.All methods? I can get what I need with the JsonObject.ToObject() but I’d like to undesrtand a bit those things I don’t get!

    If there is a use of iterator, is it possible to have a small educational example.

    EDIT: Forgot to call .All(), was calling .All so was receiving a function pointer…

    thx

    #11679

    abakobo
    Participant

    here’s my (working) test code for those who want a simple Json example

    #11681

    papgar
    Participant

    That’s the risk of using := I guess.  🙂

    #11692

    nerobot
    Participant

    Some additional iteration cases:

    #11696

    abakobo
    Participant

    Thanks nerobot!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.