Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I keep getting this error after a var has been filled:

   106890 LUA: Global: DVar = Fuel_L_Bravo OFF
   106906 LUA: C:\FSUIPC7\Test_Keys.lua:46 fn: UpdateWnd
   106937 LUA: C:\FSUIPC7\Test_Keys.lua:47 fn: UpdateWnd
   106953 LUA: C:\FSUIPC7\Test_Keys.lua:48 fn: UpdateWnd
   106968 *** LUA Error: C:\FSUIPC7\Test_Keys.lua:48: attempt to concatenate global 'Dvar' (a nil value)

Have been over examples, plug-ins. Can't seem to find where it is wrong (my eyes may be getting too old).

function UpdateWnd()
    ipc.writeUD(0x66C2, 5)  -- Set Bravo for  Message
    if val == nil then
        mess = (" T - "..Dvar)
        ipc.writeSTR(0x3380,mess)
    else
        message = (" T - "..Dvar.." Value = "..val)
        ipc.writeSTR(0x3380,mess)
        val = nil
    end
end

PS - This is a test lua to double check using the events in the aircraft

Test_Keys.log Test_Keys.lua

Posted

Dvar isn't defined anywhere, so when you declare it in a function I suspect it will be local to that function - try defining DVar at the top of your script, e.g.
    local DVar = "no value"

the variable val used in function UpdateWnd() is also never declared and will always be nil.

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

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.