Detlef_747 Posted April 1, 2022 Report Share Posted April 1, 2022 Hi, I have started to write a simple variable tracker for Lvars and Hvars. Starting from the Lua examples log lvars.lua and record to csv.lua I managed to generate a .csv file in the format I need. I noticed that there are these library functions: ipc.readLvar("name") and ipc.readLvarSTR("name) Trying with the FlyByWire A320 for FS2020 I found no STR variable at all Is that just the aircraft or am I doing something wrong? -- By using "assert" you get an error message if this fails f = assert(io.open("am_fs2020_vars.csv","w")) -- write the CSV column headings -- possible Types: L (for Lvars), H (for Hvars) -- poosible Subtypes: F (for float), S (for string), U (for unknown) default is F --f:write("\r\nType,Subtype,Name\n") f:write("Type,Subtype,Name,Value\n") ipc.log("Searching for Lvars") count = 0 for id=0, 65535 do name = ipc.getLvarName(id) if id == nil then break end subtype = "U" value = ipc.readLvar(name) if value ~= nil then subtype = "F" else value = ipc.readLvarSTR(name) if value ~= nil then subtype = "S" end end count = count+1 f:write(string.format("L,%s,%s,", subtype, name)) if subtype == "F" then f:write(string.format("%0.6f", value)) elseif subtype == "S" then f:write(string.format("(((%s)))", value)) else f:write("(((unknown)))") end f:write("\n") end ipc.log(count .. " Lvars found.") -- write a CSV line to the open file f:write(string.format("A test: %02.4f\n", 3)) -- tidy up at end ... f:write("\n") f:close() And some more questions: 1) There are no STR variables for Hvars, right? 2) Is there a way to find out the unit, that an Lvar is using? E.g. ft or degrees or bar... ? 3) Is there a way to see what are output, what are input variables? Thank you Detlef Link to comment Share on other sites More sharing options...
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
Already have an account? Sign in here.Sign In Now