You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unsure how to implement some things for Tony, since I find some parts of the specification unclear. (For more information, also see Pasu4/neuro-api-tony#17)
What is undefined?
The specification for the action command states:
data: The JSON-stringified data for the action, as sent by Neuro. This should* be an object that matches the JSON schema you provided when registering the action. If you did not provide a schema, this parameter will usually be undefined.
It is unclear to me what undefined means in this context. I see two possible interpretations:
The data field should have the JSON value null, since it is kind of equivalent to a null value in JavaScript. I don't know any other languages that have undefined as a literal, so I'm assuming it comes from JS.
The data field should be omitted. This is what Randy does.
Difference between multiple ways of declaring an action parameterless-less
The specification for the schema of an Action states:
If your action does not have any parameters, you can omit this field or set it to {}.
Randy handles both cases differently (expandable logs below):
When the game omits the schema field, Randy omits the data field.
Are these two ways of handling a schema-less action interchangeable? I.e. should I expect Neuro to return either of the two possible return values in both cases?
The text was updated successfully, but these errors were encountered:
Yes they should be interchangeable. Both for the mod passing schema and neuro passing data.
Your implementation should be as robust as possible, you cannot have any expectations. That's why stuff like #39 shouldn't really matter. Whether ANYTHING is undefined/omitted, null, or just an empty object, it should never matter neither for Neuro nor for the game.
I am unsure how to implement some things for Tony, since I find some parts of the specification unclear. (For more information, also see Pasu4/neuro-api-tony#17)
What is
undefined
?The specification for the
action
command states:It is unclear to me what
undefined
means in this context. I see two possible interpretations:data
field should have the JSON valuenull
, since it is kind of equivalent to anull
value in JavaScript. I don't know any other languages that haveundefined
as a literal, so I'm assuming it comes from JS.data
field should be omitted. This is what Randy does.Difference between multiple ways of declaring an action parameterless-less
The specification for the
schema
of anAction
states:Randy handles both cases differently (expandable logs below):
When the game omits the
schema
field, Randy omits thedata
field.Note that
data: undefined
here means that the data field is omitted.When the game sets the
schema
field to{}
, Randy returns"{}"
in thedata
field.Are these two ways of handling a schema-less action interchangeable? I.e. should I expect Neuro to return either of the two possible return values in both cases?
The text was updated successfully, but these errors were encountered: