MCPcopy Create free account
hub / github.com/cuberite/cuberite / LoadFile

Method LoadFile

src/Bindings/LuaState.cpp:212–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210
211
212bool cLuaState::LoadFile(const AString & a_FileName)
213{
214 ASSERT(IsValid());
215
216 // Load the file:
217 int s = luaL_loadfile(m_LuaState, a_FileName.c_str());
218 if (ReportErrors(s))
219 {
220 LOGWARNING("Can't load %s because of an error in file %s", m_SubsystemName.c_str(), a_FileName.c_str());
221 return false;
222 }
223
224 // Execute the globals:
225 s = lua_pcall(m_LuaState, 0, LUA_MULTRET, 0);
226 if (ReportErrors(s))
227 {
228 LOGWARNING("Error in %s in file %s", m_SubsystemName.c_str(), a_FileName.c_str());
229 return false;
230 }
231
232 return true;
233}
234
235
236

Callers 2

StartMethod · 0.80
InitializeMethod · 0.80

Calls 3

luaL_loadfileFunction · 0.85
lua_pcallFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected