MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / runCode

Method runCode

Source/Lua/CtrlrLuaManager.cpp:308–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308bool CtrlrLuaManager::runCode (const String &code, const String name)
309{
310 if (luaState && !isLuaDisabled())
311 {
312 if (luaL_loadbuffer(luaState, code.toUTF8(), std::strlen(code.toUTF8()), name.isEmpty() ? "_runtime" : name.toUTF8())
313 || lua_pcall(luaState, 0, 0, 0))
314 {
315 const char* a = lua_tostring(luaState, -1);
316 _LERR("ERROR: " + String(a));
317 lastError = "ERROR: " + String(a);
318 lua_pop(luaState, 1);
319 return (false);
320 }
321
322 return (true);
323 }
324 else
325 {
326 return (false);
327 }
328}
329
330void CtrlrLuaManager::log(const String &message)
331{

Callers 2

setBreakpointMethod · 0.45
setCodeInternalMethod · 0.45

Calls 5

luaL_loadbufferFunction · 0.85
lua_pcallFunction · 0.85
StringFunction · 0.50
toUTF8Method · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected