I have this C++ class MakeMeOnce. I have exposed it to lua in Ctrlr and I can call functions on it and everything is fine.
To call its functions I need to create an instance of it as nothing is declared static in it. I create this instance in the “panel has finished loading method”.
The problem with this is that if I open the panel again then an instance gets created again because the same method executes in the context of this new panel.
Is there any global method which gets called just once when Ctrlr starts and never again. I could create my instance there and the object would be visible in the Lua State for all panels.
I am not sure how feasible this is currently as each panel seems to have its own lua state.
How would you have managed creating a single instance of a C++ class ? This single instance should be visible in all lua panels.
-
This topic was modified 9 years, 7 months ago by synth.