Original Post
I seem to have a problem. I have embedded Lua into my engine with few difficulties, however the functions that I use to shunt my data between the LUA scripts and the main engine uses a static namespace variable to hold the value of a class holding all the subsystems that I use to render or manager game elements. Now it seems to me that the pointer breaks occasionally. Unless I manually assign the value in the WinMain scope it becomes invalid (my printing routine breaks because of this). I have a few ideas on how to solve this problem. A) Move the LUA functions and destroy the global value. This would involve making each of my lua functions a member of a subsystem or the master class. I don't think this would solve the problem. B) Simply manually assign the value in the WinMain scope and forget about it. [Which is what I am doing now] C) Somehow lock the reference so it doesn't go out of scope. It seems to die when a member class is operating on it. Not sure if that is relevant or not. I could use some advice, I'm not really sure how to go about any of these. The last time I attempted to register member functions with LUA it screamed at me and threw things. I'm sure it was my inexperience and the fact that pointers hate me. My system right now is a convoluted nest of classes within classes within classes with a great deal of redundancy and ineffiency. However I am simply going for something that functions correctly right now. I can make it fast and pretty after. [Edited by - Plasmarobo on December 21, 2008 1:51:50 PM]