pyio.load_values - pytha-3d-cad/pytha-lua-api GitHub Wiki
Loads a lua table from PYTHA's local storage. The values must have been saved by save_values. If there are no values with the specified name, it returns nil.
pytha.load_values(name)
| Parameter | Type | Description |
|---|---|---|
name |
string |
Name under which the values have been stored |
Return value
| Type | Description |
|---|---|
{...} or nil |
A table of values if successful, otherwise nil |
Remarks:
For loading user values, you can use the following syntax
local default = {...}
local values = pyio.load_values("my_values") or {}
merge_tables(values, default)
where merge_tables is
function merge_tables(dst, src)
for k, v, in pairs(src) do
local t = type(dst[k])
if t == "nil" then
dst[k] = v
elseif type(v) == "table" then
if t == "table" then
merge_tables(dst[k], v)
else
dst[k] = v
end
end
end
end