   Registrating one's Superclass
  Hello I'm new with Angelscript and I'm wonderring, if there is a possibility in Anglescript to registrate a class's baseclasses, like in luabind. In order not to need to registate all Members and Methods twice ?Previously thank You for any help.   
  Currently AngelScript doesn't support that directly. However, you can reduce the amount of code you need to write by using function grouping. An example of that is around the middle of  this thread.   ;  No, AngelScript can't do that. Since AngelScript (mostly) doesn't use wrapper functions when registering the interface there is no way for the engine itself to provide this information. A method pointer is not necessarily the same for the base class and the derived class, especially if the derived class inherits from more than one base class.However, if you follow the advice in the manual (Registering class hierarchies) you'll be able to reduce the manual work for the registration quite a bit.PS. The article in the manual was based mostly on the discussion from the thread that SiCrane mentioned.Regards,Andreas   ;  Ah, I see. So there won't be throwen an exception when I registrate a overwritten method.For example:class Base{   virtual void aMethod() { ... }};class Derived : Base{   void aMethod() { ... }};int r;// Register the base typer = engine->RegisterObjectType("derived", sizeof(Derived), asOBJ_REF); assert( r >= 0 );// Register the mehtod of the baseclassr = engine->RegisterObjectMethod("derived", "void aMethod()", asMETHOD(Base, aMethod), asCALL_THISCALL); assert( r >= 0 );// Register the mehtod of the derived classr = engine->RegisterObjectMethod("derived", "void aMethod()", asMETHOD(Derived, aMethod), asCALL_THISCALL); assert( r >= 0 );Another question:Will there be a possibility for an direct access by the AS-API to the meta-information about the registrated ObjectTypes in future ?A kind of reflection like in C# or java.   ;Quote:Original post by WitchLordNo, AngelScript can't do that. Since AngelScript (mostly) doesn't use wrapper functions when registering the interface there is no way for the engine itself to provide this information. A method pointer is not necessarily the same for the base class and the derived class, especially if the derived class inherits from more than one base class.Couldn't you use the implicit ref cast behavior to get a pointer to the base and use that to call the base class methods on derived objects? Off the top of my head, that seems like all the information you'd need to get pointers to members for the base to work with the derived class. On the downside, it'd probably be less efficient than using the derived type's member function pointers.;Quote:Original post by SiCraneCouldn't you use the implicit ref cast behavior to get a pointer to the base and use that to call the base class methods on derived objects? Off the top of my head, that seems like all the information you'd need to get pointers to members for the base to work with the derived class. On the downside, it'd probably be less efficient than using the derived type's member function pointers.That might be possible, I'll have to give this a try some day.   ;Quote:Original post by _matthias_// Register the mehtod of the baseclassr = engine->RegisterObjectMethod("derived", "void aMethod()", asMETHOD(Base, aMethod), asCALL_THISCALL); assert( r >= 0 );// Register the mehtod of the derived classr = engine->RegisterObjectMethod("derived", "void aMethod()", asMETHOD(Derived, aMethod), asCALL_THISCALL); assert( r >= 0 );You should only register the derived class' method. Otherwise you'll tell AngelScript that there are two versions of the same function, which will cause ambiguity in the script compilation.Quote:Original post by _matthias_Another question:Will there be a possibility for an direct access by the AS-API to the meta-information about the registrated ObjectTypes in future ?A kind of reflection like in C# or java.This access is available already. However, the application needs to implement the necessary functions to query the meta-information in the way you want it.I'll make further improvements towards better support for reflection in upcoming releases. But feel free to send me suggestions for how you would like it to work.   ;Quote:Original post by WitchLordYou should only register the derived class' method. Otherwise you'll tell AngelScript that there are two versions of the same function, which will cause ambiguity in the script compilation.But this double registrating would be autmatically made by your template construction, doesn't it?Quote:Original post by WitchLordI'll make further improvements towards better support for reflection in upcoming releases. But feel free to send me suggestions for how you would like it to work.I'm writting a little 3D modeling, animation & rendering tool specially for the use in schools.Here a screenshot:  On the right side you ca nsee the Channel Box or in German "Eigenschaften". This window is gereatated autmatically by a selfmade reflecting system. But I would be glad to be able to use angelscript for these too. Important to realize this is to get a list of all members (and methods) a class has.The primary use of Angelscript is to be bind all features in this tool to the script, in order to make this tool programmable at runtime and to offer Redo and Undo functionality and a interface to save/load szenes. Are you of the opinion, that all these could be possible with Angelscript ?By the way another question to Angelscipt:How fast could Angelscript be in calling highly frequently a simple function like "float wave(float x, float y) { return sin(sqrt(x^2+y^2)); }" , which is used in this sample ( by the Scriptlanguage Lua): Makes it sense to animate this with angelscript ?;  You can find out information about a script class via the asIObjectType interface. You can query the class' property information by using GetPropertyCount() to find the number of properties and then GetPropertyTypeId() and GetPropertyName() to find the name and type of each property. Similarly you can use GetMethodCount() to find the number of methods the class has and GetMethodDescriptorByIndex() to get a asIScriptFunction that will tell you about the method.   ;  Great, so I can start to rewrite my whole programm ;)Thanks a lot for the answers !This seems to be a wonderful forum. :)   