I was meaning something more along the lines of the following (a static method): class MyClass { public: MyClass(); static void bstrWrite(asBSTR *inString) { // Write the string } }; and then in your script configuration you'd put: engine->RegisterGlobalFunction("void bstrWrite(bstr &inString)", (asFUNCTION)MyClass::bstrWrite, asCALL_CDECL); I'm not really sure if this will work as I haven't had the chance to test it, but it's worth a shot =) Regards, Daniel. ----- Original Message ----- From: "Sardaukar | Brian A. Knudsen " <sardaukar@xxxxxxxxxxxxxxxxxxxxx> To: <angelscript@xxxxxxxxxxxxx> Sent: 08 March, 2004 10:18 AM Subject: [angelscript] SV: Re: adding object methods as functions > Thanks for the repply, i dont know what i look for particular, as i am > exploring :)=20 > > I wanted some feedback on the subject as I'm no high-tech programmer, I > just explore using "I wonder what happens if I do try this" approach.=20 > > As for my question, I enterpret the answer as "its easier/better to > grant access to the actual object and method", correct? Sorry for > sounding like an c++ airhead ;) > > Brian > > -----Oprindelig meddelelse----- > Fra: angelscript-bounce@xxxxxxxxxxxxx > [mailto:angelscript-bounce@xxxxxxxxxxxxx] P=E5 vegne af Daniel Krenn > Sendt: 8. marts 2004 00:57 > Til: angelscript@xxxxxxxxxxxxx > Emne: [angelscript] Re: adding object methods as functions > > Wouldn't you need to use RegisterObjectMethod(...) to register the > methods. > e.g. > > engine->RegisterObjectType("MyClass", sizeof(MyClass), 0); > engine->RegisterObjectProperty("MyClass", "float myMemberVariable", > offsetof(MyClass, myMemberVariable), 0); > engine->RegisterObjectMethod("MyClass", "void bstrWrite(bstr &)", > asMETHOD(MyClass::bstrWrite), asCALL_THISCALL); > > If you're wanting to register the class methods as global functions then > I imagine you'd need to make the methods static.. I've never done this > though, since I've never had a need to. > > Regards, > Daniel. > > ----- Original Message -----=20 > From: "Brian Adsbol Knudsen" <brian@xxxxxxxxx> > To: <angelscript@xxxxxxxxxxxxx> > Sent: 08 March, 2004 9:49 AM > Subject: [angelscript] adding object methods as functions > > > > Can I add object methods as functions? I'm having a hard time trying. > > =20 > >=20 > > I want to try something like this=20 > >=20 > > r =3D engine->RegisterGlobalFunction("void bstrWrite(bstr&)", > > (asFUNCTION)::myClass:: bstrWrite, asCALL_CDECL); > > assert( r >=3D 0 ); > >=20 > > =20 > >=20 > > putting bstrWrite in a separate class for structure reasons, but > > assigning it as normal normal function within the engine. > >=20 > > =20 > >=20 > > =20 > >=20 > > Any clues ? > >=20 > > =20 > >=20 > > =20 > >=20 > >=20 > >=20 > >=20 > > AngelScript - AngelCode Scripting Library > > http://www.angelcode.com/angelscript/ > >=20 > > AngelScript - AngelCode Scripting Library > http://www.angelcode.com/angelscript/ > > > > AngelScript - AngelCode Scripting Library > http://www.angelcode.com/angelscript/ > AngelScript - AngelCode Scripting Library http://www.angelcode.com/angelscript/