Appearance
CSV
Inherits: LibTSMModule
Functions
DecodeEnd
lua
function Format.CSV.DecodeEnd(context)
-> booleanEnds a CSV decoding context and returns whether or not the data was fully decoded successfully.
Parameters:
| Name | Type | Description |
|---|---|---|
context | table | The CSV decoding context |
Returns:
| Type | Description |
|---|---|
boolean |
DecodeIterator
lua
function Format.CSV.DecodeIterator(context)
-> fun():...any, tableIterates over the CSV encoded data.
Parameters:
| Name | Type | Description |
|---|---|---|
context | table | The CSV decoding context |
Returns:
| Type | Description |
|---|---|
fun():...any | Iterator with fields matching the decoded values |
table |
DecodeStart
lua
function Format.CSV.DecodeStart(str, fields)
-> table?Creates a CSV decoding context for the specified fields.
Parameters:
| Name | Type | Description |
|---|---|---|
str | string | The CSV encoded data |
fields | string[] | The fields which are being decoded |
Returns:
| Name | Type | Description |
|---|---|---|
context | table? |
Encode
lua
function Format.CSV.Encode(keys, data)
-> stringEncodes the specified data to a CSV string.
Parameters:
| Name | Type | Description |
|---|---|---|
keys | string[] | The list of keys to encode |
data | table | The data to encode |
Returns:
| Type | Description |
|---|---|
string |
EncodeAddRowData
lua
function Format.CSV.EncodeAddRowData(context, data)Adds a row to the CSV encoding context.
Parameters:
| Name | Type | Description |
|---|---|---|
context | table | The CSV encoding context |
data | table | The data for the row |
EncodeAddRowDataRaw
lua
function Format.CSV.EncodeAddRowDataRaw(context, ...)Adds a raw row to the CSV encoding context.
Parameters:
| Name | Type | Description |
|---|---|---|
context | table | The CSV encoding context |
... | string | The raw data for the row |
EncodeEnd
lua
function Format.CSV.EncodeEnd(context)
-> stringEnds a CSV encoding context and returns the resulting CSV string.
Parameters:
| Name | Type | Description |
|---|---|---|
context | table | The CSV encoding context |
Returns:
| Type | Description |
|---|---|
string |
EncodeStart
lua
function Format.CSV.EncodeStart(keys)
-> tableCreates a CSV encoding context for the specified keys.
Parameters:
| Name | Type | Description |
|---|---|---|
keys | string[] | The keys which are being encoded |
Returns:
| Type | Description |
|---|---|
table |