MCPcopy Create free account
hub / github.com/anjo76/angelscript / ScriptCreateCoRoutine

Function ScriptCreateCoRoutine

sdk/add_on/contextmgr/contextmgr.cpp:72–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void ScriptCreateCoRoutine(asIScriptFunction *func, CScriptDictionary *arg)
73{
74 if( func == 0 )
75 return;
76
77 asIScriptContext *ctx = asGetActiveContext();
78 if( ctx )
79 {
80 // Get the context manager from the user data
81 CContextMgr *ctxMgr = reinterpret_cast<CContextMgr*>(ctx->GetUserData(CONTEXT_MGR));
82 if( ctxMgr )
83 {
84 // Create a new context for the co-routine
85 asIScriptContext *coctx = ctxMgr->AddContextForCoRoutine(ctx, func);
86
87 // Pass the argument to the context
88 coctx->SetArgObject(0, arg);
89
90 // The context manager will call Execute() on the context when it is time
91 }
92 }
93}
94
95#ifdef AS_MAX_PORTABILITY
96void ScriptYield_generic(asIScriptGeneric *)

Callers 1

Calls 3

SetArgObjectMethod · 0.80
GetUserDataMethod · 0.45

Tested by

no test coverage detected