MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / ExecSourceCode

Method ExecSourceCode

src/lua/LuaHandle.cpp:207–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205
206
207bool LuaHandle::ExecSourceCode(const std::string& code, const std::string& label) {
208 int error = luaL_loadbuffer(L, code.c_str(), code.size(), label.c_str());
209
210 if (error != 0) {
211 LuaLog(0, "Lua LoadCode loadbuffer error = %i, %s, %s\n",
212 error, GetName().c_str(), lua_tostring(L, -1));
213 lua_pop(L, 1);
214 return false;
215 }
216
217 error = lua_pcall(L, 0, 0, 0);
218
219 if (error != 0) {
220 LuaLog(0, "Lua LoadCode pcall error(%i), %s, %s\n",
221 error, GetName().c_str(), lua_tostring(L, -1));
222 lua_pop(L, 1);
223 return false;
224 }
225
226 return true;
227}
228
229
230//============================================================================//

Callers

nothing calls this directly

Calls 6

LuaLogFunction · 0.85
c_strMethod · 0.80
luaL_loadbufferFunction · 0.50
GetNameFunction · 0.50
lua_pcallFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected