Skip to main content

SaveTable

This function was added in DSL 4

Description

Save a table to a file given a relative path.

The same restrictions apply here as with PackTable.

function SaveTable(name, table) --[[ ... ]] end

Parameters

  • name: string - The name of the file to save the table to. This should be a relative path, such as data/my_table.lua. The file will be created if it does not exist, or overwritten if it does.
  • table: table - The table to save. This can be any Lua table, including nested tables. The table will be serialized to a Lua script that can be loaded later using LoadTable.

Return Values

None.

Example

local myTable = {
name = 'Example',
values = {1, 2, 3},
nested = {key = 'value'}
}

SaveTable('data/my_table.lua', myTable)

See Also