json.array
Creates a table marked for JSON array encoding.
Syntax
Signature
json.array(Table: table?) -> tableAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Table | table? | Table whose array entries should be copied. |
Returns
| Type | Description |
|---|---|
table | New table marked as a JSON array. |
Notes
When Table is supplied, copies its sequential entries from 1 through its length. The input table is left unchanged and non-array fields are not copied. With no argument, returns an empty marked array.
Example
Luau
local Empty = json.array()
print(json.encode(Empty))
local Copy = json.array({1, 2, 3})
print(json.encode(Copy))