Joerg 66 Posted July 25, 2012 Report Posted July 25, 2012 Hello! 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, Jörg
Pete Dowson Posted July 26, 2012 Report Posted July 26, 2012 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. Pete
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now