Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
SimTX Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Lua extension API
(section)
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Controls == Controls create ordinary transmitter widgets and provide live values to callbacks. An ID must start with a letter or underscore, contain only letters, digits, and underscores, and contain at most 64 characters. Control and input IDs in one modulation must be unique. The helper form is recommended: <syntaxhighlight lang="lua"> controls = { simtx.controls.slider("gain", { label = "Gain", help = "Linear input gain.", unit = "x", precision = 2, min = 0, max = 2, step = 0.01, default = 1, }), simtx.controls.toggle("enabled", {label = "Enabled", default = true}), simtx.controls.text("message", {label = "Message", default = "CQ"}), simtx.controls.choice("shape", { label = "Shape", options = { "soft", {value = "hard", label = "Hard edges"}, }, default = "soft", }), } </syntaxhighlight> The equivalent long form is a table with an <code>id</code> and <code>type</code>. The slider aliases are <code>range</code> and <code>number</code>. Checkbox aliases are <code>check</code>, <code>bool</code>, <code>boolean</code>, and <code>toggle</code>. <code>string</code> is a text alias. Choice aliases are <code>select</code>, <code>dropdown</code>, and <code>combo</code>. {| class="wikitable" ! Control !! Fields and defaults !! Lua value |- | Slider || <code>min=0</code>, <code>max=1</code>, <code>step=0</code>, <code>default=min</code>, optional <code>unit</code> and <code>precision</code> || Number |- | Checkbox || <code>default=false</code> || Boolean |- | Text || <code>default=""</code> || String |- | Choice || Non-empty <code>options</code>; <code>default</code> is the first option || String value |} All controls accept <code>label</code>, <code>help</code>, and <code>default</code>. A label defaults to the ID. Help text may contain at most 300 characters. Slider units may contain at most 16 characters. Slider precision may be 0 to 8, or may be omitted so the interface derives it from the step. Slider values and bounds must be finite, <code>max</code> must exceed <code>min</code>, and the default must be within the range.
Summary:
Please note that all contributions to SimTX Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
SimTX Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)