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

Syntax errors

Started by
7 comments, last by WitchLord 10 years, 7 months ago

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

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


ActorDynamicSky @sky;


sky @= ActorDynamicSky();

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

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

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

The updated version AngelBinder
https://bitbucket.org/nick_galko/angelbind/src

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.

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

how i can call the class ctor,not using copy-constructor?(in C++ it's "new")

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.

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