yaml.save(filename, table)function
Encodes a Lua table into YAML and writes it to a file. Returns true and nil on success, or false and an error message on failure.
Parameters
filename
A File object or a filename string, representing the YAML file.
table
The Lua table to encode and save.
Return value
On success, returnstrue. On failure, returns false and an error message string
Example
--! luart-extensions
import yaml
local t = {name = "Bob", age = 42}
local ok, err = yaml.save("person.yaml", t)
if not ok then print("Save failed:", err) end