Jump to content
The simFlight Network Forums

Equivalent Lua commands


Recommended Posts

Hi Pete,

 

I am a complete novice at programming so please bear with me. I am trying to program the MFD's in the default Hornet using LUA.

 

This picture shows the FSUIPC button definition that is working.

post-33879-0-83061300-1384225508.jpg

 

Is this Lua command (not working) the equivalent to that FSUIPC programming?

 

function Rt_MFD_Button_5 ()

  ipc.writeDD(x3110, x00011205)

end

 

Thanks for all your help

Link to comment
Share on other sites

function Rt_MFD_Button_5 ()

  ipc.writeDD(x3110, x00011205)

end

 

Thanks for all your help

 

Programming languages all have different ways of representing numbers in different radices. The Lua (and C/C++) way of representing a hexadecimal number is by preceding it with "0x" not just "x". To most languages, anything that begins with a letter is a name, not a number. The 0 tells them it is a number, and the x says it is in hex. FSUIPC doesn't need this convention because you can't use names, so it simplifies just to x.

 

So your line should be

 

  ipc.writeDD(0x3110, 0x00011205)

 

I see you are embodying it in a function. I assume you have something calling that function?

 

Regards

Pete

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.