Jump to content
Sign in to follow this  
Damlimey

Quick question to save time...

Recommended Posts

Hi all,

And this week's question is:

If I am testing a button state and I am using x = ipc.testbutton(2, 11) and as the library says, the return will be either TRUE or FALSE, would I then put...

if  (x == TRUE) then

or

if (x == "TRUE") then

or, am I asking the wrong question?

Here's the whole chunk...

function switchcon ()
x = ipc.testbutton(2, 11)
if (x == TRUE) then
function fuelchecka ()
function fuelcheckb ()
end
if (x == FALSE) then
sound.stop("Warning_Fuel_Tone")
sound.stop("Warning_Fuel")
end
end

Thanks in advance,

G

Share this post


Link to post
Share on other sites

LUA is case sensitive. Use

if val == true then

or

if val == false then

 

Edited by ScotFlieger

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Share this post


Link to post
Share on other sites

Thank you once again, that was the issue, lower case not caps. It is expressed as caps in the .lua library document so that's my excuse this time around.

Thanks again,

G

Share this post


Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...