User prop add real

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

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

user_prop_add_real will add an additional user customizable setting to your instrument of the type float.

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_real("Warning Speed Limit", 2.2, 3.0, 2.5, "Speed limit where the warning light should be visible")
alert_user_prop = user_prop_add_real("Alert Speed Limit", 4.3, 5.3, 5.0, "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