How to register this by angelscript ?
class A
{
operator const char* ( ) const
{
//do something ...
}
};
How to register it ? use METHOD() or METHODPR( ) ?
Good question. :)
I think, you can use asMETHOD like this:
asMETHOD(A, operator const char*)
I think, you can use asMETHOD like this:
asMETHOD(A, operator const char*)
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Thanks again ~~ I will try it :P
error C2833: 'operator const' is not a recognized operator or type
it give me an error when I try to use asMETHOD( classname, operator const char* )
:(
[Edited by - zopenge on April 6, 2008 11:54:50 PM]
error C2833: 'operator const' is not a recognized operator or type
it give me an error when I try to use asMETHOD( classname, operator const char* )
:(
[Edited by - zopenge on April 6, 2008 11:54:50 PM]
I successfully did it with:
I'm using MSVC7.1. What compiler are you using?
class A{public: operator const char * ( ) const { return 0; }};engine->RegisterObjectMethod("obj", "void f()", asMETHOD(A, operator const char *), asCALL_THISCALL);
I'm using MSVC7.1. What compiler are you using?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Perhaps if you try it without the macro, i.e:
If that still doesn't work I suggest you write a light wrapper function:
asSMethodPtr<sizeof(void (c::*)())>::Convert(&c::operator const char *)
If that still doesn't work I suggest you write a light wrapper function:
const char *ClassName_CastConstCharPtr(const ClassName *obj){ return (const char *)obj;}RegisterObjectMethod("obj", "void f()", asFUNCTION(ClassName_CastConstCharPtr), asCALL_CDECL_OBJLAST);
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
Popular Topics
Advertisement