An application may need to expose different interfaces to different types of scripts, e.g. a game entity may only have access to specific set of functions, while the GUI script can have access to a completely different set of functions.
To accomplish this the application can set a bitmask while registering the interface, and then use that bitmask when building the scripts to determine what the scripts should or should not be able to access.
{
}
{
int r;
CScriptBuilder builder;
r = builder.StartNewModule(engine, script);
if( r < 0 ) return r;
r = builder.AddSectionFromFile(script);
if( r < 0 ) return r;
return builder.BuildModule();
}
@ asCALL_CDECL
A cdecl function.
Definition: angelscript.h:305
#define asFUNCTION(f)
Returns an asSFuncPtr representing the function specified by the name.
Definition: angelscript.h:708
The engine interface.
Definition: angelscript.h:1125
virtual int RegisterGlobalFunction(const char *declaration, const asSFuncPtr &funcPointer, asDWORD callConv, void *auxiliary=0)=0
Registers a global function.
virtual asDWORD SetDefaultAccessMask(asDWORD defaultMask)=0
Sets the access mask that should be used for subsequent registered entities.
The interface to the script modules.
Definition: angelscript.h:2261
virtual asDWORD SetAccessMask(asDWORD accessMask)=0
Sets the access mask that should be used during the compilation.
The access mask can be defined for the following entities in the application interface: