Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I am trying to allocate a lua script to a button.  The script is a one-liner :-

ipc.writeLvar [“C310_LEFT_FUEL_PUMP”, 0]
end

I keep getting the following error message "*** LUA Error: C:\FSUIPC7\C310 Lpump high.lua:1: unexpected symbol near 'â'  which I do not understand.  It is probably something simple but I cannot see it.

Despite several hours of searching here and on tinternet I cannot get rid of the error, can anyone help me please?

Posted
38 minutes ago, DEN19 said:

ipc.writeLvar [“C310_LEFT_FUEL_PUMP”, 0]
end

Its normal brackets, not square ones, and you don't need the end, and be careful with the quote symbol,  i.e.
    ipc.writeLvar ("L:C310_LEFT_FUEL_PUMP", 0)

    

Posted

John, thanks for the rapid response.

I noticed that you had put an L: in front of the C310 so I pasted your text in and it stopped the error msg, but it still did not work.  I guess the L; was missed because I copied it from the list of Lvars I obtained from the log file after using the "List Lvars" instruction and it wasn't shown there.  I didn't put it in because the Lua Library pdf said it wasn't necessary.

However changing the Lvar to C310_SW_FUEL_PUMP_LEFT did!

I don't follow your comment re the " signs, could you explain for me please?

Posted
14 minutes ago, DEN19 said:

I noticed that you had put an L: in front of the C310 so I pasted your text in and it stopped the error msg, but it still did not work.  I guess the L; was missed because I copied it from the list of Lvars I obtained from the log file after using the "List Lvars" instruction and it wasn't shown there.  I didn't put it in because the Lua Library pdf said it wasn't necessary.

The 'L:' is optional - I like to use it - force of habit. Your code was failing for the other reasons I mentioned, not that.

14 minutes ago, DEN19 said:

I don't follow your comment re the " signs, could you explain for me please?

There are various quote signs - if you look at the lua documentation for the ipc.writeLvar function, you will see that the double quotes around name are right and left sloped (i.e. opening and closing double-quotes) - this is what some editors/word processors insert, but for lua code you should just use standard double-quotes. Some folks get in trouble by using the wrong double-quote, which can be difficult to spot.

Please note I am now on holiday until January.

John

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.