🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Default parameters within namespace

Started by
1 comment, last by WitchLord 9 years, 7 months ago

I have some binding code along these lines:


engine->SetDefaultNamespace("MyNamespace");

engine->RegisterObjectType("MyType", sizeof(MyType), asOBJ_VALUE | as OBJ_POD | ...);

engine->RegisterObjectMethod("SomeObject", "MyType AFunction(MyType param = MyType()) const", ...);

If in script you call AFunction() and don't provide the default parameter, that script will fail to compile with:


Identifier 'MyType' is not a data type
A cast operator has one argument
Identifier 'MyType' is not a data type
The type of the default argument expression doesn't match the function parameter type

Is it possible to make the compiler look at the current 'default namespace' when resolving this default parameter?

Thank you!

Advertisement

Yes, it should be possible to make the compiler use the namespace of function that the default arg is being evaluated for. I'll look into it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This has been implemented in revision 2049. Thanks.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement