MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / LoadScript

Method LoadScript

Source/Scripting/angelscript/ascontext.cpp:274–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274bool ASContext::LoadScript(const Path &path) {
275 // Compile the script code
276 int r = CompileScript(path);
277 if (r < 0) {
278 DisplayFormatError(_ok, true, "Error", "Could not compile script: %s", path.GetFullPath());
279 return false;
280 }
281
282 if (LoadExpectedFunctions() == false) {
283 std::stringstream ss;
284 for (unsigned i = 0; i < expected_functions.size(); i++) {
285 if (expected_functions[i].mandatory && expected_functions[i].func_ptr == NULL) {
286 ss << expected_functions[i].definition << std::endl;
287 }
288 }
289 DisplayFormatError(_ok_cancel, true, "Error", "Could not initialize script %s, missing expected functions:\n%s", path.GetFullPath(), ss.str().c_str());
290 return false;
291 }
292
293 if (kDebugLineCallback) {
294 ctx->SetLineCallback(asFUNCTION(DebugLineCallback), &module, asCALL_CDECL);
295 }
296
297 current_script = path;
298 if (asdebugger_enabled)
299 ASDebugger::AddContext(this);
300 if (asprofiler_enabled) {
301 ASProfiler::AddContext(this);
302 profiler.SetContext(this);
303 }
304
305 return true;
306}
307
308void ASContext::LoadScriptFromText(const std::string &text) {
309 // Compile the script code

Callers 8

ParticleSystemMethod · 0.80
InitializeMethod · 0.80
ChangeControlScriptMethod · 0.80
InitializeMethod · 0.80
InitializeMethod · 0.80
InitializeMethod · 0.80
InitializeMethod · 0.80
InitializeMethod · 0.80

Calls 8

GetFullPathMethod · 0.80
SetLineCallbackMethod · 0.80
SetContextMethod · 0.80
CompileScriptFunction · 0.50
DisplayFormatErrorFunction · 0.50
sizeMethod · 0.45
c_strMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected