Jump to content
The simFlight Network Forums
Sign in to follow this  
flatdog

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

var LandingGearLights = 0x29C

and then in the code use:

event.offset(LandingGearLights)

(I know offset 0x29C isn't really landing gear lights).

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • 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.