For that i am using the nav_get option to get the runway information.
I read an ICAO from a table created with airac data information.
I then fill a local table with runway info.
It seems the table is lost (table size is 0) when returning out of the function of nav get data; LUA code continues with empty table
i think i can workaround this, but what is the way to go with this?
Code: Select all
local Runway_available = {}
runway_screen = canvas_add(10,60,300,530)
function data_runways(runways)
if runways ~= nil then
for i=1, #runways do
table.insert(Runway_available ,runways[i]["NAME"])
print(Runway_available[i])
end
else
print("Error while querying nav data")
end
canvas_draw(runway_screen, function()
if #Runway_available ~= nil then
if #Runway_available <= 8 then
for i = 1, #Runway_available do
--print to canvas
end
end
end
end)
for i = 1, #Runway_available do
print(Runway_available[i])
end
end
function data_airports(airports)
if airports ~= nil then
-- Print the found airports to log
for i=1, #airports do
airportid = airports[i]["ID"]
nav_get("RUNWAY", "AIRPORT_ID", airportid, data_runways)
end
else
print("Error while querying nav data")
end
end
nav_get("AIRPORT", "ICAO", "EHEH", data_airports)
print(#Runway_available)