lubyk logo

Lubyk documentation

Parameter save and restore

This class acts as a proxy around lua tables allowing paramter save and recall.

Dependencies

  • yaml

Class functions

.new (filepath)

Create a new parameter helper saving content to filepath. If the file path is not provided, the default is to use the current script name with ".yml" extension. For example "foo.lua" parameters would be saved to "foo.lua.yml".

Methods

:proxy (original_table, proxy_name, settings)

Create a proxy table to write to instead of the original. Writing to the proxy stores the parameter value and write the value into the original table. Since a single Param object can store values from different tables, the proxy_name string is used to separate values during save/restore. Default value for proxy_name is 'main'.

:control (ctrl, key, value)

nodoc value is already mapped to [0,1].

:mapParameter (ctrl_name, ctrl_key, proxy_name, key)

Map parameter. If proxy_name and key are omitted, the last changed parameter is used instead.

:dump ()

Serialize all preset values to yaml.

:savePreset ()

Save current table values in current preset.

:selectPreset (preset_name)

Select preset named preset_name and load all values defined in preset into original tables. Values not defined in the preset are not removed and will be saved with preset.

:copyToPreset (preset_name)

Copy all currently defined values to preset_name. If the preset already exists, it is replaced.

Controller methods

:addController (name, settings)

Add a new controller. The optional settings table can contain the following keys:

minminimal value set by controller (0)
maxmaximal value set by controller (1)