MCPcopy Create free account
hub / github.com/InoriRus/Kyty / RunScript

Function RunScript

source/lib/Scripts/src/ScriptsLoader.cpp:51–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51bool RunScript(const String& lua_file_name)
52{
53 Scripts::ScriptError err = Scripts::RunFile(lua_file_name);
54 if (err != Scripts::ScriptError::Ok)
55 {
56 String err_str = String::FromPrintf("can't run file %s\n", lua_file_name.C_Str());
57 switch (err)
58 {
59 case Scripts::ScriptError::FileError: err_str += String::FromPrintf("file error\n"); break;
60 case Scripts::ScriptError::SyntaxError:
61 err_str += String::FromPrintf("syntax error:\n%s\n", Scripts::GetErrMsg().C_Str());
62 break;
63 case Scripts::ScriptError::RunError:
64 err_str += String::FromPrintf("run error:\n%s\n", Scripts::GetErrMsg().C_Str());
65 break;
66
67 case Scripts::ScriptError::UnknownError:
68 default: err_str += U"unknown error\n";
69 }
70
71 SetLoadError(err_str);
72 return false;
73 }
74 return true;
75}
76
77} // namespace Kyty::Scripts

Callers

nothing calls this directly

Calls 2

RunFileFunction · 0.85
SetLoadErrorFunction · 0.85

Tested by

no test coverage detected