JSON vs Behaviour Array "types"
-
@Deeeds by "the function" they do mean the modify array behaviour.
Array behaviours let you make the array manually, whereas the json format is ["value1","value2","value3",etc.]. Allowing us to use json means it can be used on arrays saved with save values, or sent through broadcast message. The output of an array behaviour is in json.
I never actually read the documentation and did not know it works on a dictionary, that's actually really useful for looping through if you wanted to reverse a dictionary, which is exactly what I wanted to do a while ago.
-
@Jack8680 Sorry, this hasn't made it any clearer.
Let's start with the basics.
I can choose an Array of type "Behaviour". This is VERY strange use of language, to me.
What does Behaviour mean in this context?
And what is an "Array Behaviour"?
Sorry, I come from other worlds where this lexicon doesn't parse so well.
-
@Deeeds all the nodes are called behaviours. E.g. Add values behaviour, move to point behaviour, etc. The array behaviour is the behaviour under custom called Array.
-
@Jack8680 Ok, so the word you're misusing might be "make", then... in this sentence:
Array behaviours let you make the array manually,
I think you might have meant "modify", "edit", "alter", "change" or something like that, right?
Because I've looked for a way to make things with code in hyperPad, and only found Spawn. Or am I missing something amazing?
-
@Deeeds yeah I meant you can use the 'array' behaviour to make a predefined array, rather than typing it out into something like a box container.
-
@Jack8680 Argh, ok. So I'm seeing what's going on. It's not a type change, it's a mode of operation for the "Modify Array" Behaviour that's changed by selecting whether to use the behaviour in JSON editing mode or hyperPad Array editing mode. Frankly, given that ANYTHING can be dragged into the slot for the chosen array, I'd have thought the mode should change based on the content its given.
But I'm talking in ideals. So ignore my opinions.
-
@Deeeds if you use modify array on an 'array' behaviour, it will update the array. For other values you have to set them to the output of 'modify array' to update them; for example, using 'modify array' on a box container doesn't change the box container, it just returns the modified array.
What do you mean by change based on the content it's given? You either select a behaviour or use a json value. You can use the array behaviour as a json value, but it won't update it.
There's a pointer switch, but I don't remember what it does since it doesn't seem to work on box containers and arrays update anyway.
-
@Jack8680 What do you mean by operate a Modify Array Behaviour on a Box Container?
I'm lost there.
-
@Deeeds you could for example put the following in a box container or an attribute:
["value1","value2"]
And then 'modify array' can use this json string as its input array. -
@Jack8680 argh, I see what's going on. There's been an attempt to create a visual means of doing network communication. Intriguing. I'll get to that, in time, no doubt. And then have much to say about it ;)
-
@Jack8680 I've just tested this, and it doesn't behave the way I'd expect.
Array Type = Value
Selected myArray (named LapTimes)
Modification is Append
Value to Append is a laptimeDo this, and there is never anything added to the array, despite everything else working correctly.
I would expect this adds a value to the array, and extends the length of the array in doing so.
Array Type is one that stores values, I've picked the right one, I've chosen to modify it by appending a value and selected a valid value
Now, here's the weird part... what does work as I'd expect the above to work is this:
Array Type = Behaviour
Selected myLapTimes Array
Modification is Append Value
Value is a lap timeWhy?
WTF?
Am I completely misunderstanding what an array of type Values is?
Am I misunderstanding what "type" means in this context?
EDIT:
And what exactly is array of type JSON?
Why is this responding like a normal array of values if it's of type JSON?