Devices Lua API: Difference between revisions

From Off Grid Wiki
Jump to navigation Jump to search
m (Rich moved page Devices Lua API to Lua Apis/Devices Lua API without leaving a redirect)
mNo edit summary
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{OffGridDocStart}}
<!-- This file is auto generated, please don't edit manually! -->
= Devices =
= Devices =
== Description ==
== Description ==
Line 9: Line 9:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 15: Line 17:
|}
|}
'''Description''': Change the powered on state of the device
'''Description''': Change the powered on state of the device
'''Returns''': Nothing
'''Notes''': See provided devices page to see how each device handles this call
=== TogglePower ===
<syntaxhighlight source lang="lua">Devices.TogglePower(deviceName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| deviceName || string
|}
'''Description''': Flip the powered on state of the device


'''Returns''': Nothing
'''Returns''': Nothing
Line 23: Line 39:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 34: Line 52:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 40: Line 60:
|}
|}
'''Description''': Change the active state of the device
'''Description''': Change the active state of the device
'''Returns''': Nothing
'''Notes''': See provided devices page to see how each device handles this call
=== ToggleActive ===
<syntaxhighlight source lang="lua">Devices.ToggleActive(deviceName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| deviceName || string
|}
'''Description''': Flip the active state of the device


'''Returns''': Nothing
'''Returns''': Nothing
Line 48: Line 82:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 59: Line 95:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 71: Line 109:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 77: Line 117:
|}
|}
'''Description''': Begin an 'Amok' state, cause the device to act in an unstable/broken manor
'''Description''': Begin an 'Amok' state, cause the device to act in an unstable/broken manor
'''Returns''': Nothing
'''Notes''': See provided devices page to see how each device handles this call
=== ToggleAmok ===
<syntaxhighlight source lang="lua">Devices.ToggleAmok(deviceName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| deviceName || string
|}
'''Description''': Flip the amok state


'''Returns''': Nothing
'''Returns''': Nothing
Line 85: Line 139:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 96: Line 152:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 110: Line 168:
'''Expected parameter types'''
'''Expected parameter types'''
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Type
|-
|-
| deviceName || string
| deviceName || string
Line 116: Line 176:


'''Returns''': The value of the device
'''Returns''': The value of the device
=== GetDataInventory ===
<syntaxhighlight source lang="lua">Devices.GetDataInventory(deviceName, index)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| deviceName || string
|-
| index || number
|}
'''Description''': Get the description of the data at this index in the DataInventory
'''Returns''': A description of that piece of data
=== GetDataPointFromInventory ===
<syntaxhighlight source lang="lua">Devices.GetDataPointFromInventory(deviceName, index)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| deviceName || string
|-
| index || number
|}
'''Description''': Get a table of useful data from the DataPoint at this index in the DataInventory
'''Returns''': A description of that piece of data
=== GetDataInventoryCount ===
<syntaxhighlight source lang="lua">Devices.GetDataInventoryCount(deviceName)</syntaxhighlight>
'''Expected parameter types'''
{| class="wikitable"
|-
! Name !! Type
|-
| deviceName || string
|}
'''Description''': Get the number of DataPoints in the DataInventory of this device
'''Returns''': The number of DataPoints




This file is auto generated, please don't edit manually!


'''Docs last hacked together on''': 09/05/2017 12:46
'''Docs last hacked together on''': 23/07/2020 11:58
[[Category:Modding]][[Category:LuaAPI]]

Revision as of 12:31, 23 July 2020

Devices

Description

The Devices API is used to control the behavior of provided devices in the level kit each of these calls will have a slightly different response to each of these calls. Please see the devices page for a full break down.

Functions

SetPower

Devices.SetPower(deviceName, state)

Expected parameter types

Name Type
deviceName string
state bool

Description: Change the powered on state of the device

Returns: Nothing

Notes: See provided devices page to see how each device handles this call

TogglePower

Devices.TogglePower(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Flip the powered on state of the device

Returns: Nothing

Notes: See provided devices page to see how each device handles this call

GetPower

Devices.GetPower(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Get the powered on state of the device

Returns: If the device is currently powered on

SetActive

Devices.SetActive(deviceName, state)

Expected parameter types

Name Type
deviceName string
state bool

Description: Change the active state of the device

Returns: Nothing

Notes: See provided devices page to see how each device handles this call

ToggleActive

Devices.ToggleActive(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Flip the active state of the device

Returns: Nothing

Notes: See provided devices page to see how each device handles this call

GetActive

Devices.GetActive(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Get the active state of the device

Returns: If the device is currently active

RunOnce

Devices.RunOnce(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Trigger a single update of the device

Returns: Nothing

Notes: See provided devices page to see how each device handles this call

SetAmok

Devices.SetAmok(deviceName, state)

Expected parameter types

Name Type
deviceName string
state bool

Description: Begin an 'Amok' state, cause the device to act in an unstable/broken manor

Returns: Nothing

Notes: See provided devices page to see how each device handles this call

ToggleAmok

Devices.ToggleAmok(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Flip the amok state

Returns: Nothing

Notes: See provided devices page to see how each device handles this call

GetAmok

Devices.GetAmok(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Get the 'Amok' state of the device

Returns: If the device is currently running 'Amok'

SetValue

Devices.SetValue(deviceName, newValue)

Expected parameter types

Name Type
deviceName string
newValue string

Description: Pass a string value to the device

Returns: Nothing

Notes: See provided devices page to see how each device handles this call

GetValue

Devices.GetValue(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Get the current value of the device

Returns: The value of the device

GetDataInventory

Devices.GetDataInventory(deviceName, index)

Expected parameter types

Name Type
deviceName string
index number

Description: Get the description of the data at this index in the DataInventory

Returns: A description of that piece of data

GetDataPointFromInventory

Devices.GetDataPointFromInventory(deviceName, index)

Expected parameter types

Name Type
deviceName string
index number

Description: Get a table of useful data from the DataPoint at this index in the DataInventory

Returns: A description of that piece of data

GetDataInventoryCount

Devices.GetDataInventoryCount(deviceName)

Expected parameter types

Name Type
deviceName string

Description: Get the number of DataPoints in the DataInventory of this device

Returns: The number of DataPoints


This file is auto generated, please don't edit manually!

Docs last hacked together on: 23/07/2020 11:58