| 134 | } |
| 135 | |
| 136 | void LuaState::internal_execute(const char *statement, bool clear) |
| 137 | { |
| 138 | // There may be other things on the stack so save the top of it |
| 139 | const int stacktop = lua_gettop(L); |
| 140 | |
| 141 | int status = luaL_loadstring(L, statement); |
| 142 | |
| 143 | if (status == LUA_OK) { |
| 144 | status = lua_pcall(L, 0, LUA_MULTRET, 0); |
| 145 | } |
| 146 | else if (status == LUA_ERRSYNTAX) { |
| 147 | qWarning("LUA_ERRSYNTAX: %s", statement); |
| 148 | } |
| 149 | else if (status == LUA_ERRMEM) { |
| 150 | qFatal("Lua memory allocation error"); |
| 151 | } |
| 152 | |
| 153 | if (status != LUA_OK) { |
| 154 | // Print an error message |
| 155 | //writeErrorToOutput(lua_tostring(L, -1)); |
| 156 | //writeErrorToOutput("\r\n"); |
| 157 | qWarning("%s", lua_tostring(L, -1)); |
| 158 | } |
| 159 | |
| 160 | if (clear) |
| 161 | lua_settop(L, stacktop); |
| 162 | } |
| 163 | |
| 164 | void LuaState::executeFile(const QString &fileName) |
| 165 | { |
nothing calls this directly
no outgoing calls
no test coverage detected