Jump to content
The simFlight Network Forums

LUA best practice question


Recommended Posts

When I purchased 2 of the A2A GA aircraft, I had to write Lua programs to get my GoFlight RP48 buttons to work the audio panels of those aircraft. Now I have 3 separate programs, 1 for each A2A GA plane, and 1 for all of the FSX default planes. The meat of the code is different, some code is common.  Each program is about 300 lines of code. My question (for those in the know) is there any performance penalty or benefit of the approach to coding one way or another of these alternatives:

  1. Separate Lua program for each plane, loaded by the FSUIPC profile for that plane
  2. A single Lua program with the Lua program determining which function to call based on which plane is active
  3. A common Lua program which loads another Lua program based on which plane is active.  (This is unlikely to be any different than #2 because the common code is so small as to be trivial).

So which approach should I use for best runtime performance, or does it matter?

 

I'm using FSX and FSUIPC4.949f on Windows 10

 

Gene

Link to comment
Share on other sites

When I purchased 2 of the A2A GA aircraft, I had to write Lua programs to get my GoFlight RP48 buttons to work the audio panels of those aircraft. Now I have 3 separate programs, 1 for each A2A GA plane, and 1 for all of the FSX default planes. The meat of the code is different, some code is common.  Each program is about 300 lines of code. My question (for those in the know) is there any performance penalty or benefit of the approach to coding one way or another of these alternatives:

  1. Separate Lua program for each plane, loaded by the FSUIPC profile for that plane
  2. A single Lua program with the Lua program determining which function to call based on which plane is active
  3. A common Lua program which loads another Lua program based on which plane is active.  (This is unlikely to be any different than #2 because the common code is so small as to be trivial).

So which approach should I use for best runtime performance, or does it matter?

 

I'm using FSX and FSUIPC4.949f on Windows 10

 

In terms of performance, and probably ease of understanding, your simplest would be the one to choose -- i.e. option 1. The other two are just making things more complicated for no good reason.

 

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.