Xpl command subscribe

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

xpl_command_subscribe(commandref,callback_function)

xpl_command_subscribe is used to subscribe to a x-plane command.

Return value

This function won't return any value.

Arguments

# Argument Type Description
1 commandref String Reference to a command from X-plane (see CommandRefs)
2 callback_function Function The function to call when a new command has been sent within X-plane

Example

-- This function will be called when the dial has gone up
 function fms_key_callback(typecmd)
   print("FMS key 0")

   -- Can be BEGIN, ONCE or END
   print("Command type = " .. typecmd)
 end

 -- subscribe to Air Manager command
 xpl_command_subscribe("sim/FMS/key_0", fms_key_callback)