🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Build() and AddScriptSection()

Started by
2 comments, last by WitchLord 18 years, 3 months ago
In the tutorial the function AddScriptSection() and Build() are wrapped together in one sample function. Is this always ok (i.e. I add code from 4 files and thus call Build() 4 times), or should I generally add all my scripts and then call Build as a final step?
Advertisement
What scripting language is this? Are you using C, C++, C# etc...? Could you provide a little more information please?

But generally, I guess it depends on how the script system works. If it needs a build after each script section is added, then yes, keep them together, else just call build at the end of the script generation.
Well, I use AngelScript on top of C++.

I guess the question boils down to wether Build() will compile everything ever added with AddScriptSection(), or only the stuff added after the last call to Build().
(I suspect the later, but I was not entirely sure after taking a look in the documention)


EDIT:

After playing around a bit, I figured out this:
If you want to have several scripts, the only right way to do this is by
calling AddScriptSection() a number of times and then Build() once.
Correct?

[Edited by - B_old on March 22, 2006 8:33:35 AM]
Correct. The Build() call compiles everything added to that module since the last Build() call (or since the creation of the engine).

When the Build() completes AngelScript will forget all the script codes that were built, i.e. free the memory if AngelScript made a copy, or simply clear the pointer if no copy was made.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement