Original Post
Hi Everybody! It's another day of AngelScript meets my engine :). This time I am wondering what will be the best way for me to use script modules and sections. One solution is to use modules for every script (eg. every game object has it's own module). Plus is that I can compile changes to game object script separately and I don't have to restart everything. Minus is that all game objects have separate environment (global vars etc) and there is probably bigger memory overhead. Other solution would be to use modules per gameplay/menu. Plus is that game objects see each other environment. Minus that after I change one game object's script I have to add all of them to module and build (it's not a problem after shipping a game because then scripts are closed). Do you see other solutions or pluses/minues for my solutions? I was wondering how to implement script function LoadScript(path, section, module) (load text from file, add to module, build). First if I call LoadScript with name of module I am calling LoadScript from, what will be side effect of that? Am I replacing code currently being executed? Should I always load script to different module then currently executing one? If so, what will be the best way to interact from script with code loaded to different module? It seems complicated... I'd prefer to stay with "one module for all" solution, but how can I load scripts from scripts then? WitchLord, thank you for explanations... You said you store the GameObject as a member of the script class, and GameObject also have a pointer to the script object. How do you avoid circular references then? Cheers Tristan