Jump to content
The simFlight Network Forums

Using ipc.readLvar() with names with spaces


Recommended Posts

MOVED TO THE FSUIPC SUPPORT FORUM

Hi Pete

Some of the Lvars for the Aerosoft Airbus contain spaces (e.g. TURB ENG1 EPR) instead of the usual convention of using underscore (_). When these particular Lvars are used with ipc.readvar() FSUIPC4 returns a nil value (not found). However, when I can trace these Lvars using LINDA. Does the ipc.readLvar() command strip out the space characters?

Link to comment
Share on other sites

40 minutes ago, Scotfleiger said:

MOVED TO THE FSUIPC SUPPORT FORUM

Hi Pete

Some of the Lvars for the Aerosoft Airbus contain spaces (e.g. TURB ENG1 EPR) instead of the usual convention of using underscore (_). When these particular Lvars are used with ipc.readvar() FSUIPC4 returns a nil value (not found).

Please ALWAYS post questions or support requests to the Support Forum, unless very specifically concerned with mentions in the SunForum, in which case they should be appended to the relevant tab.

BTW I assume you mean "ipc.readLvar" not "ipc.readvar", which doesn't exist. ;-)

49 minutes ago, Scotfleiger said:

However, when I can trace these Lvars using LINDA.

This sentence seems to finish rather abruptly. Did you trace with LINDA? Why? Where does LINDA come into it? Did you try tracing using the facilities in FSUIPC?

50 minutes ago, Scotfleiger said:

Does the ipc.readLvar() command strip out the space characters?

No, there is no "stripping out" of anything at all.  And names with spaces in a certainly okay -- one of the default FSX ones is "L:EFIS Mode", and the default FSX 738 actually features as many as 31 different ones with embedded spaces -- and they all work fine.

Pete

 

 

Link to comment
Share on other sites

Thank you Pete. That is strange. In a LINDA module LUA function I have used the instruction  x = ipc.readLvar("TURB ENG1 EPR") which returns a nil value and flags an error. When I trace the same Lvar (with spaces) in the LINDA tracer it works correctly and I can see the returned values.

The missing 'L' in ipc.readLvar was caused by autocorrect.

Link to comment
Share on other sites

7 minutes ago, aua668 said:

Hi,

 

Have you already tried:    x = ipc.readLvar("L:TURB ENG1 EPR")

 

That's how I read Lvars (with success).

 

Rgds

Reinhard

 

Yes thank you aua668. I tried using 'L:' (optional) and I get the error 'attempt to call field 'readLVar' (a nil value)' in the line with the statement:

epr = pic.readLvar("L:TURB ENG1 EPR").

Link to comment
Share on other sites

14 hours ago, Scotfleiger said:

I tried using 'L:' (optional) and I get the error 'attempt to call field 'readLVar' (a nil value)' in the line with the statement:

epr = pic.readLvar("L:TURB ENG1 EPR").

I just checked, and, in fact, if you try to read an L:var which doesn't exist you actually get zero, not "nil" -- there's an error in my code there, which I will correct in the next FSUIPC update.  Currently you can only check whether it exists or not by using

n = ipc.getLvarId("name")

which will return nil if it doesn't exist.

But from what you say, the "nil" error you are getting is because it thinks the function you are calling doesn't exist. There's no library called "pic", so that could be one reason -- or is that another autocorrection gone wrong?

Also is isn't "readLVar" but "readLvar" -- another autocorrection? Surely not? Lua is case sensitive -- every character must be correctly upper or lower case.

If you really are using ipc.readLvar then I think you need LINDA support. I don't know what it is doing to get that screwed up, I don't know it at all I'm afraid.

BTW use the built-in FSUIPC assignable control "List local panel variables" to get a list of all the valid L:vars for the current aircraft, and their current values.

Pete

 

 

 

Link to comment
Share on other sites

On 25 June 2016 at 8:36 PM, Pete Dowson said:

I just checked, and, in fact, if you try to read an L:var which doesn't exist you actually get zero, not "nil" -- there's an error in my code there, which I will correct in the next FSUIPC update.  Currently you can only check whether it exists or not by using

n = ipc.getLvarId("name")

which will return nil if it doesn't exist.

But from what you say, the "nil" error you are getting is because it thinks the function you are calling doesn't exist. There's no library called "pic", so that could be one reason -- or is that another autocorrection gone wrong?

Also is isn't "readLVar" but "readLvar" -- another autocorrection? Surely not? Lua is case sensitive -- every character must be correctly upper or lower case.

If you really are using ipc.readLvar then I think you need LINDA support. I don't know what it is doing to get that screwed up, I don't know it at all I'm afraid.

BTW use the built-in FSUIPC assignable control "List local panel variables" to get a list of all the valid L:vars for the current aircraft, and their current values.

Pete

Thank you for the confirmation and information Pete. I was beginning to pull my hair out (and there is not much on top to come out).

PS. You are correct. I was trying to type the non-word "ipc" but autocorrect kept changing it to "pic" fast they I could see that it was doing it. 

Edited by Scotfleiger
Added PS
Link to comment
Share on other sites

On ‎6‎/‎25‎/‎2016 at 8:36 PM, Pete Dowson said:

Also is isn't "readLVar" but "readLvar" -- another autocorrection? Surely not? Lua is case sensitive -- every character must be correctly upper or lower case.

That was what was causing the Nil errors. I was using readLVar and not readLvar. My apologises for the hassle.

Link to comment
Share on other sites

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.