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

Method FindOrAddCode

sdk/angelscript/source/as_builder.cpp:230–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230asCScriptCode *asCBuilder::FindOrAddCode(const char *name, const char *code, size_t length)
231{
232 for (asUINT n = 0; n < scripts.GetLength(); n++)
233 if( scripts[n]->name == name && scripts[n]->codeLength == length && memcmp(scripts[n]->code, code, length) == 0 )
234 return scripts[n];
235
236 asCScriptCode *script = asNEW(asCScriptCode);
237 if (script == 0)
238 return 0;
239
240 int r = script->SetCode(name, code, length, true);
241 if (r < 0)
242 {
243 asDELETE(script, asCScriptCode);
244 return 0;
245 }
246
247 script->idx = engine->GetScriptSectionNameIndex(name);
248 scripts.PushLast(script);
249 return script;
250}
251
252void asCBuilder::EvaluateTemplateInstances(asUINT startIdx, bool keepSilent)
253{

Callers 1

Calls 4

SetCodeMethod · 0.80
PushLastMethod · 0.80
GetLengthMethod · 0.45

Tested by

no test coverage detected