An inter-instrument value. Other instruments on this panel can read and write it.
Parameters
#
Name
Type
Description
1 .. n
variable
String
Reference to a SI variable
2 .. n
unit
String
Data type of the variable, can be INT, FLOAT, DOUBLE, BYTE, BOOL, STRING, INT[n], FLOAT[n], DOUBLE[n] or BYTE[n]
last
callback_function
Function
The function to call when new data is available
Example
-- A value other instruments on this panel can readsi_variable_subscribe("selected_altitude", 3000)
Photo slot: shots/si_variable_subscribe.png
si_variable_write
Simulation Instrument Studio 1
Overloads
si_variable_write(var_id, value)
An inter-instrument value. Other instruments on this panel can read and write it.
Parameters
#
Name
Type
Description
1
var_id
String
Reference to a global variable. Can be obtained using si_variable_create.
2
value
Object
The new value to write. You have to obay to the data type you have chosen in the si_variable_create function. It is not allowed to change type at runtime.
Example
-- A value other instruments on this panel can readsi_variable_write("selected_altitude", 3000)
Photo slot: shots/si_variable_write.png
ext_command
Simulation Instrument Studio 1
Overloads
ext_command(source_tag, event, value)
An external data call. It publishes and subscribes outside the simulator.
Parameters
#
Name
Type
Description
1
source_tag
String
The data source tag. The source tag can be configured in the settings part of Studio.
2
event
String
Command name in the external source
3
value
Number
(Optional) Send a value with the command. Some commands support setting a value.
Example
-- A value from outside the simulatorext_command("efis", "altitude")
ext_variable_write(source_tag,variable, unit, value)
An external data call. It publishes and subscribes outside the simulator.
Parameters
#
Name
Type
Description
1
source_tag
String
The data source tag. The source tag can be configured in the settings part of Studio
2
variable
String
Reference to a variable on the external source
3
type
String
Data type of the variable, can be INT, FLOAT, DOUBLE, INT[n], FLOAT[n], DOUBLE[n] or BYTE[n]
4
value
Number
The value to be written
Example
-- A value from outside the simulatorext_variable_write("efis", "altitude")
Photo slot: shots/ext_variable_write.png
layer_add
Simulation Instrument Studio 1
Overloads
layer_add(z_order, callback)
layer_add(z_order, callback, input_event_callback)
layer_add(z_order, x, y, w, h, callback)
layer_add(z_order, x, y, w, h, callback, input_event_callback)
A layer groups drawing and mouse handling inside one instrument.
Parameters
#
Name
Type
Description
1
z_order
Number
The Z order. Lowest value is drawn at the back, highest is drawn on the top. The panel/instrument root lua is always drawn at order 0.
2
x
Number
(Optional) X position in pixels of the layer
3
y
Number
(Optional) Y position in pixels of the layer
4
width
Number
(Optional) Width in pixels of the layer
5
height
Number
(Optional) Height in pixels of the layer
6
callback
Function
Callback function. Add GUI nodes (such as img_add, txt_add. etc. etc.) you create within this function will be added to this layer.
7
input_event_callback
Function
(Optional) Callback where input events (mouse & touch) are sent. Callback arguments are id, x, y and finger_id.
Example
-- A click layer over the Kollsman knoblayer_add(80, 170, 80, 40, function()
log("kollsman")
end)
Photo slot: shots/layer_add.png
layer_mouse_cursor
Simulation Instrument Studio 1
Overloads
layer_mouse_cursor(layer_id, cursor)
A layer groups drawing and mouse handling inside one instrument.
Parameters
#
Name
Type
Description
1
layer_id
ID
Layer identifier. This can be obtained by calling function layer_add.
2
cursor
String
The cursor type, see the list below. It is also possible to add you own custom cursor proving your own from resources folder, this image must be 32x32 32-bit PNG file.
Cursors
Name
Looks like
NONE
No cursor.
POINTER
Arrow.
HAND
Hand.
CW
Clockwise.
CCW
Counterclockwise.
GRAB
Grab.
LEFT
Arrow left.
RIGHT
Arrow right.
TOP
Arrow up.
BOTTOM
Arrow down.
A 32×32 PNG in the instrument resources folder is also accepted.
Example: a fixed cursor, and one that follows the mouse
layer_mouse_cursor(knob_layer, "CW")
function on_move(id, x, y)
if x < 80 then
layer_mouse_cursor(knob_layer, "LEFT")
elseif x > 160 then
layer_mouse_cursor(knob_layer, "RIGHT")
else
layer_mouse_cursor(knob_layer, "HAND")
end
end
Photo slot: shots/layer_mouse_cursor.png
instrument_add
Simulation Instrument Studio 1
Overloads
instrument_add(uuid, plugin_uuid, x, y, width, height)
instrument_add(uuid, plugin_uuid, x, y, width, height, callback)
instrument_add(uuid, plugin_uuid, x, y, width, height, user_properties, callback)
instrument_add(uuid, plugin_uuid, x, y, width, height, user_properties, hw_properties, callback)
Adds or reads another instrument from this one.
Parameters
#
Name
Type
Description
1
uuid
UUID
Make sure each of your instruments within this panel gets a unique uuid. You can generate an UUID here.
2
plugin_uuid
String
The UUID string for the instrument plugin.
3
x
Number
This is the most left point of the canvas where your instrument should be shown.
4
y
Number
This is the most top point of the canvas where your instrument should be shown.
5
width
Number
The instrument width on the canvas.
6
height
Number
The instrument height on the canvas.
7
user_properties
Table
(Optional) Instrument user properties.
8
hw_properties
Table
(Optional) Instrument hardware properties.
9
callback
Function
(Optional) Callback is called when the instrument is created.
Example
-- Create the instrument, first argument is your own generated UUID, second argument is the plugin UUIDinstrument_add("5ed42efb-9e53-42a0-92ad-e2b0730e2306", "dc979f8e-ab07-4cb0-b755-eac3b9fbd601", 0, 300, 200, 200)
Photo slot: shots/instrument_add.png
instrument_get
Simulation Instrument Studio 1
Overloads
instrument_get(uuid)
instrument_get(uuid, offset)
Adds or reads another instrument from this one.
Parameters
#
Name
Type
Description
1
uuid
String
The UUID string for the instrument.
2
offset
Number
(Optional) Offset when multiple instruments of the same type are part of the panel.
Example
id = instrument_get("fd2f89a1-59ec-416f-8f28-e5b8bf4c1cbc")
if id ~= nil then
-- Make the instrument invisiblevisible(id, false)
else
print("Could not find instrument")
end