Jump to content

  • Log In with Google      Sign In   
  • Create Account


dkrusu

Member Since 09 Dec 2012
Offline Last Active Jun 18 2014 09:10 PM

#5013579 Possible namespace bug?

Posted by dkrusu on 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.




PARTNERS