MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / LoadAppScript

Method LoadAppScript

Source/Player/Application.cpp:65–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool Application::LoadAppScript(const char *sandboxName) {
66 state = &gameWorld->GetLuaVM().State();
67
68 const BE1::Guid appScriptGuid = BE1::GameSettings::playerSettings->GetProperty("appScript").As<BE1::Guid>();
69 const BE1::Str appScriptPath = BE1::resourceGuidMapper.Get(appScriptGuid);
70
71 char *data;
72 size_t size = BE1::fileSystem.LoadFile(appScriptPath, true, (void **)&data);
73 if (!data) {
74 return false;
75 }
76
77 BE1::Str name = appScriptPath;
78
79 if (!state->LoadBuffer(name.c_str(), data, size, sandboxName)) {
80 BE1::fileSystem.FreeFile(data);
81 return false;
82 }
83
84 BE1::fileSystem.FreeFile(data);
85
86 state->Run();
87
88 sandbox = (*state)[sandboxName];
89
90 return true;
91}
92
93void Application::StartAppScript() {
94 LuaCpp::Selector startFunc = sandbox["start"];

Callers 5

InitInstanceFunction · 0.80
InitDisplayFunction · 0.80
appInitFunction · 0.80
initUIMethod · 0.80
appInitFunction · 0.80

Calls 8

StateMethod · 0.80
GetPropertyMethod · 0.80
LoadBufferMethod · 0.80
FreeFileMethod · 0.80
RunMethod · 0.80
GetMethod · 0.45
LoadFileMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected