Skip to content

JSON Box

NebelFox edited this page Feb 19, 2022 · 10 revisions

Box object

Consist of a mandatory commands property and an optional style property. Boxes support inheritance!
(In examples "base-style" and "derived-style" are from here)

Commands property

Takes an array of Executable. The order is maintained.

{
    "commands": [
        "foo",
        { "name": "bar" }
    ]
}

Style property

Sets the style for the box. Could be a string - name of a defined style in styles object in the file root. Is set to "default" if omitted.

{
    "style": "derived-style"
}

Or it could be an "anonymous" style object, defined just in place. It's treated as a regular Style object, so you can use all its features.

{
    "style": {
        "base": "base-style",
        "dialogue": {
            "farewell": "Bye..."
        }
    }
}

Example

{
    "style": {
        "base": "base-style",
        "dialogue.greeting": "Greetings!"
    },
    "commands": [
        "command-with-only-a-name",
        {
            "name": "parameterless-command"
        },
        {
            "name": "max",
            "brief": "prints the max integer",
            "params": ["values:int..."]
        },
        {
            "name": "namespace",
            "commands": [
                "nested-command",
                {
                    "name": "nested-namespace",
                    "commands": ["foo", "bar"]
                }
            ]
        }
    ]
}
Clone this wiki locally