Sign in to follow this  

Possible namespace bug?

Recommended Posts

I'm not sure if this is intentional or a bug. When writing in the script language namespaces seem to inherit everything from the global, but when registering it it doesn't:


Script code:

namespace test {

    void blah() {

        string s;





That works, but if I register a global function inside of a namespace like this

pEngine->RegisterGlobalFunction("bool foo(const string &in)", asFUNCTION(Foo), asCALL_CDECL);


I get the following error:

System function (1, 18) : ERR  : Identifier 'string' is not a data type
 (0, 0) : ERR  : Failed in call to function 'RegisterGlobalFunction' with 'bool isDir(const string &in)' (Code: -10)
VelScript: /home/droz/Projects/Velox/VelScript/Include/Script.h:235: void Vel::Script::FunctionGroup::Register(asIScriptEngine*): Assertion `Ret >= 0' failed.

If I register it with:

pEngine->RegisterGlobalFunction("bool foo(const ::string &in)", asFUNCTION(Foo), asCALL_CDECL);


it works.

Share this post

Link to post
Share on other sites
At the moment AngelScript doesn't search for symbols in the parent namespaces. With the current implementation it is actually a bug that the script sees the string type inside the namespace. The script should behave as the registration does.

I'll look into implementing the search for symbols in the parent namespaces as soon as possible. I only held off on it because I wanted the basic namespace feature to mature enough before that, i.e. most of the bugs identified and fixed.


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