I'm trying to to get X-Plane FlyWithLUA to connect to an Arduino Mega256.
I have 1 line of code: (After stripping away everything else that isn't failing)
dev = com.open("COM4", 9600, 0)
This code fails with:
lua:1: attempt to index global 'com' (a nil value)
What the heck am I missing?
The error appears to point to a missing DLL or something... I've spent the past couple evenings trying to figure this out and all I've done is bump Heineken Beer stock up a few points.
You've probably seen this, but shouldn't that be io.open() ?
I hate Lua.
Have you verified that "COM4" is the exact spelling of the com port the Arduino is connected to. The error is actually telling you that "COM4" is pointing to a nil value.
OK - this is for FSX or P3D, but I imagine the same code structure works for both.
I had to post on X-Plane.org for this.
com.open() should work but "com" isn't recognized, nor is "ipc"
I swear I'm missing something stupid-simple...
The only thing I can think of is that you are missing the COM library with your Lua installation.
That Geekforge lua code will not work with X-Plane it is for FSUIPC only. Pete included a COM library in FSUIPC with it.
When I first tried to get my radio working with X-Plane, I could not figure out how to get the lua com library installed and or working.
I bailed on FlywithLua, dabbled with C#, and settled with the Python Plugin.
I got the radio working nearly as good as with P3D but acceleration on HDG bug and CRS knob varies from plane to plane. Some airplane devs use their own datarefs which can nul some functionality...until you code it in. Just like in P3D, with devs using custom Lvars, one size does not fit all...without a table, anyway.
The nice thing about the Python plug in is that you can have multiple py scripts running just like LUA in FSUIPC.
If you go with Python Plugin, ye best be knowin how to indent propper like, lest ye be stuck in the damnation of the error log.
I was slowly coming to that realization last night that maybe this just won't work in X-Pain.
I'll try the Python plugin. Interestingly, I am learning Python since I need that skill in a new role at work.
Thanks again for the info. Now I can stop bashing my head against the wall.
I love Python.
I HATE SNAKES.......... J/K
Quote from: Trevor Hale on February 19, 2021, 01:57:51 PMI HATE SNAKES.......... J/K
My on-again/off-again Python X-Plane library is called SOAP (Snakes on a Plane). It is humourous on so many levels (not least that it isn't finished).