Jump to content
The simFlight Network Forums

Does writing to a nonexistent Lvar create one?


Recommended Posts

Quick question--if I use ipc,writeLvar in a Lua script to write to an Lvar that does not presently exist, is a new Lvar created or does it just ignore the write? 

If not, is there a mechanism in FSUIPC to create a new Lvar in a Lua script or macro?

Regards

Bob Scott

Link to comment
Share on other sites

Writing to a non-existent lvar should create the lvar, but I am not 100% sure on this (may be for MSFS2020 only), as the documentation does say: If the variable is not currently available, nothing happens.

To create an lvar in lua, you should use the ipc.createLvar function:

Quote
ipc.createLvar(“name”, initialValue)
[Not WideClient]
This creates a new FS local panel variable called “name” and sets its initial value. These are L: <name> values. You can provide the L: part explicitly or leave it out.

John

 

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.