Skip to content

Issue with "array" #1

Open
Open

Description

@Paaskehare

Tried to parse this:

{
        "Hero"          "lion"
        "Title"         "Lion (Scratch)"
        "GuideRevision"         "1"
        "Scratch"               "1"
        "ItemBuild"
        {
                "Items"
                {
                        "#DOTA_Item_Build_Starting_Items"
                        {
                                "item"          "item_tango"
                                "item"          "item_flask"
                                "item"          "item_courier"
                                "item"          "item_branches"
                                "item"          "item_ward_observer"
                        }
                        "Support"
                        {
                                "item"          "item_ward_observer"
                                "item"          "item_ward_sentry"
                                "item"          "item_smoke_of_deceit"
                                "item"          "item_dust"
                        }
                        "#DOTA_Item_Build_Core_Items"
                        {
                                "item"          "item_magic_wand"
                                "item"          "item_boots"
                                "item"          "item_tranquil_boots"
                                "item"          "item_urn_of_shadows"
                                "item"          "item_force_staff"
                        }
                        "#DOTA_Item_Build_Luxury"
                        {
                                "item"          "item_ghost"
                                "item"          "item_mekansm"
                                "item"          "item_pipe"
                                "item"          "item_blink"
                                "item"          "item_veil_of_discord"
                                "item"          "item_cyclone"
                                "item"          "item_vladmir"
                                "item"          "item_bracer"
                                "item"          "item_necronomicon"
                                "item"          "item_ultimate_scepter"
                                "item"          "item_sheepstick"
                                "item"          "item_travel_boots"
                        }
                }
        }
}

But the KeyValues parser ends up with this:

"HeroGuide"
{
    "Hero" "lion"
    "Title" "Lion (Scratch)"
    "GuideRevision" "1"
    "Scratch" "1"
    "ItemBuild"
    {
        "Items"
        {
            "#DOTA_Item_Build_Starting_Items"
            {
                "item" "item_ward_observer"
            }
            "Support"
            {
                "item" "item_dust"
            }
            "#DOTA_Item_Build_Core_Items"
            {
                "item" "item_force_staff"
            }
            "#DOTA_Item_Build_Luxury"
            {
                "item" "item_travel_boots"
            }
        }
    }
}

As you can see the parser overrides when there are multiple keys with the same name, it should be handled as an array.

Note that this is a valid keyvalues file from the Dota2 Game

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions