Advertisement

Failed to register global property with property accessor

Started by February 08, 2021 08:54 PM
3 comments, last by WitchLord 3 years, 9 months ago

Hey,

I am trying to register a global property that has a custom getter function.

I register it like this:
engine->RegisterGlobalFunction("string get_resourceName() const property", asFunctionPtr(GetResourceName), asCALL_CDECL);

The GetResourceName function exists and also the string type is registered (I am sure because I have a global function above it that also uses the string type, and it works)

But when I run it then I get the following error:
Failed in call to function 'RegisterGlobalFunction' with 'string get_resourceName() const property' (Code: asINVALID_DECLARATION, -10)

What could the problem here be?

None

Nevermind, just a minute later I found out you can't use const with global properties…

None

Advertisement

That would be a bug in angelscript. It should be possible to use ‘const’ with global properties too.

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

Silly me. Of course you're correct. Global functions cannot have the ‘const’ decorator.

The global virtual property will be constant simply by not registering the set_ accessor.

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