Advertisement

For single module, how to incrementally compile scripts.

Started by January 17, 2021 12:08 PM
1 comment, last by WitchLord 3 years, 10 months ago

I don't know how many scripts will be added to the module. I always need to find an opportune moment to compile scripts. Unfortunately, I didn't find this time. So I want to incrementally compile the script content into the module.

Do you really need to compile it all into a single module? When you have dynamic logic that needs to be loaded after already having compiled the main module I recommend designing it so that you use separate modules, and then use handles to share the content (much how you would do it when manually loading a shared library (.dll or .so) in C++).

But if you really want to go with a single module you have two options:

1. serialize the content of the module to backup the current state, rebuild the module with the additional script sections, deserialize the content to restore the state

or

2. restrict the additional content to only global functions and global variables, i.e. no types, and use the CompileFunction, CompileGlobalVar to incrementally add these to the module (see the console sample for an implementation)

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