Sign in to follow this  
NicoG

[AS] Sections and Modules

Recommended Posts

Hi there. Angelscript is fantastic. I really like it. Compared to Lua and Python embedding I had a running sample in notime. But I have a question :D. Modules are like DLL or Libs they say - so you have plenty scripts in one module normally. Sections are not used - they are just for debugging. So between these 2 statements comes my Problem. In my ScriptAPI I want every Script to have a "int main()" in it. So I never have to care which functions the Script has, I just call the main and the Script runs. When it does not want to be run anymore, it just returns -1 in the main-method and its removed from my script-stack. Now this can be achieved by just adding every script to a different module. Is this true or did I oversee something? How do you manage the EntryPoints of your Scripts? Sorry for asking, I just never used Scripting Languages seriously before in my own Programs (besides from implementing an easy Language for loading stuff). Thanks for all the Help! Nico

Share this post


Link to post
Share on other sites
This is how I've done it. This used to be one of the biggest features that AS lacked; namely, an easy way to share modules without sharing global data. He might have fixed it by now.

Share this post


Link to post
Share on other sites
I still haven't had the time to implement cloning of modules (which will properly share bytecode to avoid extra memory consumption).

Until then you can run multiple instances of the same scripts if you design your script interface to use script classes instead of global functions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this