It is not possible to export a subroutine from a macro.
You might pass around a label of a subroutine as a string or int, but the one in the code that uses gosub/goto will be used, not the macro's that returned it.
There are two ways to solve this:
- have a subroutine collection in a macro, all their inputs as parameters plus a parameter telling which subroutine to use, and the results returned with the end command. Call the macro instead of the subroutine.
- write each subroutine in a separate macro, they can be called using a string variable for the name
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest