I have a panel with several files. One file, call it A, contains some tables for vspeed calcs and a function to retrieve the proper values based on the aircraft weight. Both the tables and function are global. File A also contains a table with a list of tables to be used for that aircraft so for aircraft A it will us3 v2speedtableA, vrefspeedtableA, eprtableA. The function basically checks the list of tables, finds the aircraft model, and then returns the table names (I guess the C equivalent is pointer to the table) for the given aircraft mode. The function is called from logic.lua.
Code: Select all
aircraft_tables = {
{
"JustFlight Tristar 500";
v2table_JF500;
vreftable_JF500;
flapsettings_JF500;
eprtable_500;
};
}
I have another table named eprtable_500,which is used to calculate EPR based on flight level and aircraft weight and is a global variable. Instead of putting it in file A I put it in file B mainly to keep like things in like files.
The function in file A is called with the aircraft type and returns values/addresses for the tables for speeds and epr. These tables are then used to calculate values for the aircraft.
The function a returns the tables for vspeeds which are contained with it in file a. However, it returns nil for eprtable_500 which is in a separate file but I thought a global could be referenced anywhere even if it's in another file so eprtable_500 should be available to file A.
How does Lua parse these lib files - is it in alphabetical order and making one pass. If so then file B variables won't be available to file A. Logic.lua sees functions in files that have names starting with letters above L. Given the functions are global and available everywhere else why not the table?
I'm at a loss here.
Also, does Air manager support require() or loadfile()? when I tried to use require or require() I get that require is nil, doesn't exist.
Thanks.