| 205 | |
| 206 | |
| 207 | bool 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 | //============================================================================// |