Flight Sim IO Server will automatically create a Lua script file called global_aircraft.lua which will contain nothing. This Lua script file will run automatically once an aircraft's virtual cockpit has loaded.

Each aircraft has its own global_aircraft.lua so it can contain aircraft specific Lua code.

global_aircraft.lua runs on its own thread so can be coded to loop continuously. Remember to add a sleep statement if looping the code so that the thread does not hog all the CPU time e.g. sleep(100).

If Bespoke variables have been used to collect switch state data or data for displays, it is recommended that the relevant Lua code is added into global_aircraft.lua so when the aircraft starts, the current state of switches and displays is updated on the Components. E.g.

setbvar("Bespoke Var 0", getkvar("switch1") & getkvar("switch2"))

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.