Jump to content
The simFlight Network Forums

How can I verify the existence of a macro in LUA?

Recommended Posts


For a LUA plug-in I need a method to determine if a macro with a name provided in a variable really exists:

I want to call macros not only by a fixed name like - ipc.macro("MyMacroFile:MyMacroName") - but also by a string variable (which contains a string transferred from an hardware device) like - ipc.macro(VarMacroFilename .. ":" .. VarMacroName)

But in the case that no macro with that name is defined, the LUA plug-in should execute some alternate actions (like transferring the string to the original hardware driver).

Some solution can be writing a constant value to one of the FSUIPC offsets for general purpose (0x66D0 … 0x66FF) before calling the macro, then implement writing another constant value to the same offset in every defined macro and checking the offset in the code after the macro call - that should work, but I think that is not what I mean with "good coding" ;)

Is there any other way to verify the existence of a FSUIPC macro in LUA?

The best way I think would be getting a return value from the ipc.macro() function that tells me if a macro with that name has been executed or not. Any chance to implement that in future? (if already implemented, I didn't find any hint neither in the documentation nor in the examples provided)

Thanks and greetings,


Link to comment
Share on other sites

Is there any other way to verify the existence of a FSUIPC macro in LUA?

No. FSUIPC is not aware of what macros exist until they are called. All it has is a numbered list of macro filenames, You can read that in the INI file. Then you'd have to read the macro file and scan the macro names, same as FSUIPC has to do in any case when you access one.


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.