Device add

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

device_id = device_add(type, offset)

device_add is used to add a device. Note that the device needs to me added within the Air Manager or Air Player before you can access it here.

See Device list for available devices.

Return value

Argument Type Description
device_id String This value can be used for further reference.

Arguments

# Argument Type Description
1 type String Device type. See Device list for available devices.
2 offset Number (Optional) When you have multiple devices of the same type, you can provide an offset.

Example

-- Add RealSimGear G5 device
my_device = device_add("REAL_SIM_GEAR_G5")

-- Print when the power button is released
device_command_subscribe("PWR_RELEASED", function()
    print"pwr released"
end)