Module system.serialization.toml

TOML configuration encoder/decoder

Index

Function

decode()

Parses TOML data into a table.

encode()

Encodes a table into TOML format. This table must only have integer or string keys in itself and each subtable, and cannot mix strings and ints.

load()

Loads a TOML file into a table.

save()

Saves a table to a TOML file.

API Reference

system.serialization.toml.encode(tbl: table, opts?: {indent: boolean}): (result: string)

Encodes a table into TOML format. This table must only have integer or string keys in itself and each subtable, and cannot mix strings and ints.

Parameters:
  • tbl (table) – The table to encode

  • opts? ({indent: boolean}) – Any options to specify while encoding

Returns:

result (string) – The encoded TOML data

system.serialization.toml.decode(str: string, opts?: {binary_escapes: boolean | nil}): (result: table)

Parses TOML data into a table.

Parameters:
  • str (string) – The TOML data to decode

  • opts? ({binary_escapes: boolean | nil}) – Options for decoding

Returns:

result (table) – A table representing the TOML data

system.serialization.toml.save(val: table, path: string, opts?: {indent: boolean})

Saves a table to a TOML file.

Parameters:
  • val (table) – The value to save

  • path (string) – The path to the file to save

  • opts? ({indent: boolean}) – Any options to specify while encoding

system.serialization.toml.load(path: string, opts?: table): (result: table)

Loads a TOML file into a table.

Parameters:
  • path (string) – The path to the file to load

  • opts? (table) – Options (none available in this version)

Returns:

result (table) – The loaded value