Kageseigi Posted October 9, 2023 Posted October 9, 2023 I'm looking for some help... I am looking to export basic data through Export.lua such as speed and altitude of my own plane so I can view it on a tablet over wifi. If I export it using the "LuaExportAfterNextFrame()" function, it works in both singleplayer and multiplayer, but I believe the export stream grows much too fast for my tablet to keep up with it, so the information on my tablet becomes very old very fast. Basically, I'm exporting two or three times faster than my tablet will read it, and it continues to read everything in order. So when I stop the game, the tablet will continue to show all of the old data until it finally reaches the end. I have tried the "LuaExportActivityNextEvent(t)" function to export data every second, and it seems to work very well and accurately in singleplayer. Unfortunately, it does not seem to work at all in multiplayer. I have been trying to learn about exporting online, but I fear I can't find much information about what I'm looking for specifically. And I don't really know where any groups are located to ask. Any help or guidance to help would be greatly appreciated! Thank you!
Kageseigi Posted June 4, 2024 Author Posted June 4, 2024 On 3/18/2024 at 5:15 AM, analina said: 你解决了吗?我也有同样的问题。 I apologize for the late reply. I just saw your question. Yes, I found out how to export only after a set interval instead of every frame. This is the code that I use: local ExportInterval = 0.03333 -- Adjust this to control how often data is exported (in seconds) local LastExportTime = 0 function LuaExportAfterNextFrame() local currentTime = LoGetModelTime() if (currentTime - LastExportTime) >= ExportInterval then local IAS = LoGetIndicatedAirSpeed() socket.try(MySocket:send(string.format("%.4f\n", IAS))) LastExportTime = currentTime end end
Recommended Posts