Jump to content
  • Advertisement
Sign in to follow this  
NickGalko

Syntax errors

This topic is 2160 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,all.

I tried register object for using in script and got some errors:

 
 
ActorDynamicSky @sky;


sky = &ActorDynamicSky();

Error:Expected expression value
 

ActorDynamicSky @sky;


sky = @ActorDynamicSky();

Error:illegal operation

But for 2 solution in this theme all is fine.

Object is created how(using angelbinder) 

Exporter::Export(*scriptEn)
[
//ActorDynamicSky
Exporter::Class<ActorDynamicSky>(asOBJ_VALUE | asOBJ_APP_CLASS_CDAK | asOBJ_ASHANDLE) 
.ctor()
 // .ctor<const ActorDynamicSky&>() 
.ctor<ActorDynamicSky>() 
.ctor<ActorDynamicSky&>()
 .dtor()
 ];
The object on C++ ActorDynamicSky is consist only ctor and dctor.
 
The version of AngelScript is 2.27.1
Edited by NickGalko

Share this post


Link to post
Share on other sites
Advertisement

The first error is because of the & character in the right-hand expression. This syntax doesn't exist in angelscript, which is why the parser gives you the error 'expected expression value'.

 

The second error is because the expression means 'assign the right-hand handle as a value to the left-hand object'. This is not a valid expression. The @ symbol should be used on the left-hand expression to indicate that you want to due a handle assignment (i.e. replace the pointer that the sky variable holds).

 

Manual: Object handles 

Share this post


Link to post
Share on other sites
ActorDynamicSky @sky;


sky @= ActorDynamicSky();

I tried to make it,but unsuccessful-is not exist is registered the copy-operator

Edited by NickGalko

Share this post


Link to post
Share on other sites

When doing the handle assignment you want to prepend the @. So @sky = instead of sky @=.

thanks.
But 

 

No appropriate opAssign method found

I dont know how bind this operator using angelbinder

Share this post


Link to post
Share on other sites

I take it you managed to solve your problem of registering the opAssign method.

 

Thanks for sharing the change you did to the angelbinder. I'm sure it is a welcome update to those that use it.

Share this post


Link to post
Share on other sites

To create new objects you just call the constructor/factory without the 'new' keyword.

 

Observe that only reference types support handles. Value types will only live as long as the variable is in the scope.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!