Jump to content
The simFlight Network Forums

Offset Syntax


Recommended Posts

Dear Pete,

In Lua scripts I have seen offsets (Pitot Heat in this case) referred to for example as:

event.offset(0x029C, ...................... and

event.offset("029C", ......................

Does one have an advantage over the other or does it simply not matter?

Thank you,

Philip

Link to comment
Share on other sites

Does one have an advantage over the other or does it simply not matter?

Doesn't really matter. Either way it's being converted to a binary number. Te most efficient way is possibly the one you've not mentioned, decimal:

Hex 029C is decimal 668. so "event.offset(668, ..." would do the same.

But I'd defy you to measure any actual difference in practice.

Regards

Pete

Link to comment
Share on other sites

I'm not familiar with Lua scripting but why can't you use varlables like:

and then in the code use:

event.offset(LandingGearLights)

Of course you can. You don't declare varaibles, though, just set them, like

"LandingGearLights = 0x29C" or

"local LandingGearLights = 0x29C"

if you want to restrict that to within a function or code block.

I don't publish a Lua language guide, only the documentation for the libraries added by FSUIPC and WideClient. The full documentation and assorted tutorials are available on the Lua website or in books you can purchase, as with other languages.

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.