| 41 | int m_value; |
| 42 | |
| 43 | static FooScripted *Factory() |
| 44 | { |
| 45 | asIScriptContext *ctx = asGetActiveContext(); |
| 46 | |
| 47 | // Get the function that is calling the factory so we can be certain it is the FooScript class |
| 48 | asIScriptFunction *func = ctx->GetFunction(0); |
| 49 | if( func->GetObjectType() == 0 || std::string(func->GetObjectType()->GetName()) != "FooScripted" ) |
| 50 | { |
| 51 | ctx->SetException("Invalid attempt to manually instantiate FooScript_t"); |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | // Get the this pointer from the calling function |
| 56 | asIScriptObject *obj = reinterpret_cast<asIScriptObject*>(ctx->GetThisPointer(0)); |
| 57 | |
| 58 | return new FooScripted(obj); |
| 59 | } |
| 60 | |
| 61 | void AddRef() |
| 62 | { |
nothing calls this directly
no test coverage detected