Returning JSON
User scripts can return JSON objects by using Result(...). Use _type to specify array types, the default is for all Lua tables to be converted into objects.
Lua
Create the object in Lua. Use _type
when something other than JSON objects is needed.
values = {
someValue="foo",
someOtherValue="bar",
arr={ _type="array", "apple", "orange" }
}
The resulting JSON
{
"someValue":"foo",
"someOtherValue":"bar",
"arr":["apple", "orange"]
}
Returning to requester
Using the Result call the data will be returned to the callee as serialized JSON data.
Result({.. any lua table ..})
Return JSON object.
- Lua table
boolean
Result({})