This set of api’s allow you to create and use settings for your plugins. Settings value are per project.
This is a module and needs to be imported before you can use it.
Once imported you include it in your lua code.
local settings=require("settings")

Settings Name

Each block of settings has a name. The names are Dot notation for organization. This breaks into a tree view in the settings menu.
MyPlugin MyPlugin.Output MyPlugin.Input
This will give you three tree items The first being MyPlugin Then under that node would appear to more. Output and Input this structure helps us organize the view.
If you change the name of a setting the old setting will be lost and new defaults will be loaded.

Setting table

The settings function takes an array of settings tables. Array being a lua table.
Each setting has the following possible values.
{ group="This setting group", -- A group to bundle the setting with label="My settign label", -- A label to identify what teh setting does settingType="String", -- Type of setting (String/Boolean/Choice/Code/Function choices="Value1,Value2,Value3", -- comma seperated list of choices if type is choice field="savedValueName", -- The saved value name for this setting codeType="text/cs", -- The mime type for the source code if this is of type code codeHeight=60, -- Height in pixels for the code editor if the type is code defaultValue='SomeDefault', -- A suitable default value of the correct type. action=function() -- Do some action. If this is of type function this is the code to run end }


This function will add a setting to the project. It should be called from your script on loading and not as a response to an action.
Settings is an array of Settings table instances. You need to define all the settings at a name in one go like this.


This can be used to change the value of a setting. You can call this from menu items or from actions added to settings themselves for easy of configuring.
You can use this to set defaults generally from a menu item of function.
name is the Setting name as described before.
field the field name of the specific setting you want to set.
value the value you want to set it to.


This is used within your actions to read the settings selected by the users and act on them.
local s=settings.getSetting=function(name)
Once you have called this you can address each setting by it’s field name in s. So if you had a setting called mySettingName you would access it with s.mySettingName