Jump to content
  • Advertisement
Dinkleberg

[SOLVED] Passing object handle to array::insertLast

Recommended Posts

I have a type registered as so:

    ScriptEngine->RegisterObjectType("Object",0,asOBJ_REF|asOBJ_NOCOUNT);

Then in my script I have this code:

array<Object@> ret = {};
const Object@ x = @game.objects[i];
ret.insertLast(x);

Which gives the error:

ai\9.as(162, 13): ERROR : No matching signatures to 'array::insertLast(const Object@&)'
ai\9.as(162, 13): INFORMATION : Candidates are:
ai\9.as(162, 13): INFORMATION : void array::insertLast(Object@const&in)

What does this mean? What's the difference between const Object@ and Object@const?

I'm sorry I don't know offhand what version of Angelscript I'm using, because someone else compiled it for me a few years ago.

Edited by Dinkleberg

Share this post


Link to post
Share on other sites
Advertisement

Your array is expecting handles to objects that are modifiable, i.e. not const. But you're trying to insert a handle to a non-modifiable object, i.e. const.

'const Object @' is a handle to non-modifiable object.

'Object @const' is a handle to a modifiable object, only the handle itself cannot be changed to refer to a different object.

Regards,

Andreas

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!