| 750 | } |
| 751 | |
| 752 | bool LuaExtension::RunString(const char *s) { |
| 753 | if (luaState || InitGlobalScope()) { |
| 754 | int status = luaL_loadbuffer(luaState, s, strlen(s), "=File"); |
| 755 | |
| 756 | if (status == LUA_OK) { |
| 757 | status = lua_pcall(luaState, 0, LUA_MULTRET, 0); |
| 758 | } |
| 759 | |
| 760 | if (status != LUA_OK) { |
| 761 | // Print an error message |
| 762 | hostTraceError(lua_tostring(luaState, -1)); |
| 763 | hostTraceError("\n"); |
| 764 | lua_settop(luaState, 0); /* clear stack */ |
| 765 | return false; |
| 766 | } |
| 767 | |
| 768 | lua_settop(luaState, 0); /* clear stack */ |
| 769 | } |
| 770 | |
| 771 | return true; |
| 772 | } |
| 773 | |
| 774 | bool LuaExtension::OnExecute(const char *s) { |
| 775 | static bool isFirstLine = true; |
nothing calls this directly
no test coverage detected