Class Checklist

Functions

Checklist.currChecklist() Returns the checklist that is currently being executed

Methods

Checklist:new(label, displayLabel, trigger) Constructor
Checklist:currItem() Returns the current item that is being executedm or nil.
Checklist:appendItem(item) Add new item to the end of the checklist.
Checklist:getItem(label) Gets item by its label
Checklist:replaceItem(item) Replaces the item with the same label as item.label.
Checklist:insertItem(label, item) Inserts an item after the item with the given label
Checklist:removeItem(label) Removes the item with the given label


Functions

Methods
Checklist.currChecklist()
Returns the checklist that is currently being executed

Returns:

  1. The checklist itself or nil.
  2. The current item, if there is a checklist, or nil.

Methods

Checklist:new(label, displayLabel, trigger)
Constructor

Parameters:

  • label string The name of the folder in copilot\sounds\callouts where the checklist-related callouts are located.
  • displayLabel string Name of the checklist that will be displayed in the message windows and logs
  • trigger A VoiceCommand that's going to be the trigger for your checklist. It can be accessed through the trigger field. Use it to control the availability of the checklist by calling myChecklist.trigger:activate()/deactivate() (see copilot\initChecklists.lua)
Checklist:currItem()
Returns the current item that is being executedm or nil.
Checklist:appendItem(item)
Add new item to the end of the checklist. Browse the lua files at copilot\checklists for examples.

Parameters:

  • item A table with the following fields (only label and response are required):
    • label string The name of the sound file inside copilot\sounds\callouts\checklistLabel
    • response Either a VoiceCommand or a table in the label=VoiceCommand key=value format where label is a string that will be passed to item.onResponse. If response is a single voice command, it is converted to a table with one key: "response".
    • displayLabel string The name of the item that will be displayed in message windows and logs (optional)
    • acknowledge string The name of the sound file inside copilot\sounds\callouts\checklistLabel that will be played if the response to the challenge is correct. If absent, no callout is played. (optional)
    • onResponse function

      A function that will be called following the response to decide whether the response was correct. It receives the following parameters:

      1. A check function.

        If it's called with a string as the single argument, the check is considered failed and the string describes the reason.

        If it's called with two arguments, the first argument is evaluated for truthiness: if the value is falsy, the check is considered failed and the second string argument describes the reason.

        The reason string is used for logging and is displayed in a message window if display_fail=1.

        The function returns a bool that indicates whether the check succeeded

      2. A RecoResult object

      3. The response voice command label

      4. A table where you can set some flags to control what happens next. The only field available is "acknowledge", which overrides item.acknowledge (see the flapSetting item in coplot\checklists\beforeTakeoff.lua for an example). This table also provides the function didFail which returns true if the check function failed at least once.

      5. The item. The response voice command can be accessed through item[label]

      (optional)
    • beforeChallenge function A function to be called before the challenge. It receives the item itself as the only parameter. (optional)
Checklist:getItem(label)
Gets item by its label

Parameters:

Returns:

    The item
Checklist:replaceItem(item)
Replaces the item with the same label as item.label.

Parameters:

Returns:

    self
Checklist:insertItem(label, item)
Inserts an item after the item with the given label

Parameters:

Returns:

    self
Checklist:removeItem(label)
Removes the item with the given label

Parameters:

Returns:

    self
generated by LDoc 1.4.6 Last updated 2021-11-11 17:10:49