rozelc Posted October 3, 2021 Report Posted October 3, 2021 I have lua program that sets a variable to 1. VarOut.lua. In the attached FSUIPC.log shows “18156 LUA.3: Global: Var1 = 1”. I have another lua program that I hoped would read and evaluate Var1 = 1. VarIn.lua Var1 is however only evaluated as == nil Usually when I have problems like this it’s typo error of syntactical error. Thanks for looking Rozel VarIn.lua VarOut.lua FSUIPC7.log
John Dowson Posted October 3, 2021 Report Posted October 3, 2021 Each lua runs in its own thread and the variables are only global to the thread. To share a variable between luas, use the ipc.set and ipc.get functions - see the FSUIPC Lua Library document. John
rozelc Posted October 3, 2021 Author Report Posted October 3, 2021 Hi John, The VarOut.lua I attached does as I expected but the VarIn.lua doesn't seem to get a nul only. Would you take a look at the VarIn.lua and see if you see my error. Rozel VarIn.lua
Pete Dowson Posted October 3, 2021 Report Posted October 3, 2021 3 hours ago, rozelc said: The VarOut.lua I attached does as I expected but the VarIn.lua doesn't seem to get a nul only. But the ipc.set in your VarOut.lua doesn't set anything: ipc.set("Var1") The syntax as documented is ipc.set(“name”, value) You are setting no value, same as nul. Pete
rozelc Posted October 4, 2021 Author Report Posted October 4, 2021 Problem solved. Thank you gentlemen. Rozel
rozelc Posted October 8, 2021 Author Report Posted October 8, 2021 Just a quick follow up on my original post. Using a modification or the TripleUse.lua that senses the push button of a rotary switch and a couple of other lua programs that sense CW or CCW of that rotary switch I can control the range of the mfd map, range of the pfd map and the barometric setting, in the G1000 nxi. Thank you so much for your help Rozel RngBaroDEC.lua PB_RotaryRange.lua INITIALIZE_VARS.lua FSUIPC7.ini RngBaroINC.lua
John Dowson Posted October 8, 2021 Report Posted October 8, 2021 @rozelcThats great, thanks. Maybe you could create a topic in the User Contributions section, and attach the files there. I am sure they would be useful to many people. Thanks, John PS. If not, no problem - I'll move them there myself, when I get a chance....
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now