Jump to content
  • Advertisement
Sign in to follow this  
dkrusu

Possible namespace bug?

This topic is 2151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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->SetDefaultNamespace("BlahNS");
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.
Aborted
 

If I register it with:

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

 

it works.

Share this post


Link to post
Share on other sites
Advertisement
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.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!