You may register your function with "CTexture@ GetTexture()" as long as the CTexture has the asBEHAVE_ADDREF and asBEHAVE_RELEASE behaviours registered. Your function should also make sure to increase the reference count for the returned pointer.
CTexture *GetTexture(){ ... // Increase the reference count for the returned pointer texture->AddRef(); return texture;}
The performance of AngelScript is good. I have exact values, but I know it is comparable to other popular scripting languages such as Lua. In some situations it might be faster, in others it might be slower. Still, AngelScript will become even faster with the coming releases as I've identified several pieces of codes that I can optimize.
AngelScript is very well suited for frame-by-frame animation.
BeatHarness uses AngelScript to script the visualization effects. I believe it calls AngelScript for each scanline which makes for at least 768 calls per frame. And the framerate is still very impressive.
Raptor Entertainment uses AngelScript for controlling just about everything in their game, including AI, scripted events, GUI, etc.
The flickering is probably because you're not using double buffering, and not because you're using AngelScript. Still, I hope you are not implementing the actual pixel copy in the script. The blit function should be implemented in C++ (or even better, the hardware) and AngelScript should simply call that function.
If your function worked the first time, but not the subsequent times, then I believe you didn't prepare the context between each call. If you intend to call the same function repeatedly you could do it like this:
(pseudo code)
engine->CreateContext(&ctx);ctx->Prepare(engine->GetFunctionIDByDecl(...));for(;;){ ctx->Execute(); if( break-condition ) break; // Prepare the same function again ctx->Prepare(-1); }