User prop add integer

From Sim Innovations Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Description

user_prop_id = user_prop_add_integer(name, min, max, default_value, description)

user_prop_add_integer will add an additional user customizable setting to your instrument of the type integer.

Return value

Argument Type Description
user_prop_id ID This value can be used for further reference. Functions such as user_prop_get can use this user_prop_id. Its good practice to store this persist_id in your logic code.

Arguments

# Argument Type Description
1 name String The name of the user property. This name must be unique (there may only be one user property of a certain name in an instrument)
2 min Number The minimum value of the property.
3 max Number The maximum value of the property.
4 default_value Number The default value of the property. The is the value the property gets when the user adds the instrument to a panel.
5 description String A description of the property, explaining to the user what function this user property has.

Example

-- Let's give our instrument two properties
warn_user_prop = user_prop_add_integer("Warning Speed Limit", 20, 40, 30, "Speed limit where the warning light should be visible")
alert_user_prop = user_prop_add_integer("Alert Speed Limit", 40, 60, 50, "Speed limit where the alert light should be visible")

-- We can check here what the user has configured
print("The warning alarm is set to " .. tostring( user_prop_get(warn_user_prop) ) )
print("The Alert alarm is set to " .. tostring( user_prop_get(alert_user_prop) ) )
Settings visible to user within instrument configuration