File: doc_adv_dynamic_config.h

package info (click to toggle)
angelscript 2.35.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,388 kB
  • sloc: cpp: 71,969; asm: 1,558; makefile: 665; xml: 214; javascript: 42; python: 22; ansic: 22; sh: 7
file content (33 lines) | stat: -rw-r--r-- 1,870 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**

\page doc_adv_dynamic_config Dynamic configurations

AngelScript supports the concept for configuration groups. This can be used for example by application plug-ins
that wish to register their own interface with the script engine. When the plug-in is later removed, the configuration
group for that plug-in can also be removed from the AngelScript interface without having to reinitialize everything.

To register part of the interface in a configuration group, the registration should be done between calls to 
\ref asIScriptEngine::BeginConfigGroup "BeginConfigGroup" and \ref asIScriptEngine::EndConfigGroup "EndConfigGroup". 
This can be done as many times as desired, but groups cannot be nested. Observe that object methods, behaviours, and 
properties will always be placed in the same group where the object type was placed even if another group has been 
specified between the calls.

To remove a configuration group the method \ref asIScriptEngine::RemoveConfigGroup "RemoveConfigGroup" should be called with the name given to the 
BeginConfigGroup. It is only possible to remove a config group that is not currently in use. Possible causes that 
prevents the removal of a group may be:

 - Another registered a function outside the group uses a type from the group
 - A script is currently built that uses a type or function from the group
 - An instance of a script object that uses a type or function from the group is alive
 
It can be difficult to determine exactly where the use comes from so here's a few steps to do when RemoveConfigGroup 
returns \ref asCONFIG_GROUP_IS_IN_USE.

 - Run a full cycle on the \ref doc_gc "garbage collector" to destroy lingering objects
 - \ref asIScriptEngine::DiscardModule "Discard" any module that may have been compiled with the group
 - Double check that no other group uses the entities from the group




*/