Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Possible namespace bug?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 dkrusu   Members   -  Reputation: 216

Like
1Likes
Like

Posted 22 December 2012 - 11:27 PM

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.



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3267

Like
1Likes
Like

Posted 23 December 2012 - 09:12 AM

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
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS