["i", ]

pcicconepciccone Posts: 661

Hello again.

I'm working on storing data in the Studio scene. I have a custom node with a DzSimpleElementData instance attache to it.
I use the DzSettings of the DzSimpleElementData to store the data.
When I do something like this:

settings->setIntValue("key", 123);

The value stored in the DUF file becomes:

"key": ["i", 123]

instead of simply:

"key": 123

I see that bool, float and string value are stored as simple key => value combo.
Is there a way of storing integer types as simple key => value pairs?

Thanks in advance.

Comments

  • rbtwhizrbtwhiz Posts: 2,181
    edited December 1969

    This is done to explicitly distinguish an int from a float, as both are simply numbers in JSON - which DSON derives. The "i" serves as an indicator to a JSON parser, to interpret the value as an integer. If you don't care whether the number is a float or an int, use floats.

    -Rob

  • pcicconepciccone Posts: 661
    edited December 1969

    All right, thank you for clarifying it. Since the values are clearly typified in Reality I can easily use float for output in both cases.

    Cheers.

Sign In or Register to comment.