[Closed] Access local variable of Macroscript
I need to be able to access variables defined in a Macroscript.
macroScript myMacro
(
local val = 5
)
myMacro --> undefined
Is there a back door I’m missing here, or is all hope lost?
Unfortunately I am not in control of the macroscript.
Oh well, time for plan B…
I think you can ask max the path of a macroscript, when you’ve got that then load the script into a string, insert own code somewhere, execute string…
that is also what i was thinking about. but you’ve asked about access. going this way you can only know about local variables existence, but can’t get/set them. you can change the code on-fly and reevaluate it, but… what is all this trouble for?
what I meant is that I will reevaluate the macroscript after manipulating the string so that the local I need will be a global.
All this trouble btw is for trying to implement a request you made
what’s wrong with using globals? i see some people on this forum who tries to not use globals at all. guys, it’s a paranoia. first, it’s impossible to code without globals. second, max itself creates thousand of globals, and who cares if you add some more?
The problem starts when you create globals with very common names, like “Settings”, “Image”, “Model”, etc.
One should always take care to name their globals specifically, prefixed with the name of the project.