Skip to content

Commit

Permalink
changed pos-- to --pos
Browse files Browse the repository at this point in the history
  • Loading branch information
Edru2 committed Apr 1, 2020
1 parent 3f36520 commit ff5e4e0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/TLuaInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8364,10 +8364,9 @@ int TLuaInterpreter::getScript(lua_State* L)
pos = lua_tonumber(L, 2);
}
Host& host = getHostFromLua(L);
pos--;

auto ids = host.getScriptUnit()->findScriptId(name);
auto pS = host.getScriptUnit()->getScript(ids.value(pos, -1));
auto pS = host.getScriptUnit()->getScript(ids.value(--pos, -1));
if (!pS) {
lua_pushnumber(L, -1);
lua_pushstring(L, QStringLiteral("script \"%1\" at position \"%2\" not found").arg(name).arg(++pos).toUtf8().constData());
Expand Down Expand Up @@ -8405,12 +8404,11 @@ int TLuaInterpreter::setScript(lua_State* L)
}
pos = lua_tonumber(L, 3);
}
pos--;

Host& host = getHostFromLua(L);
TLuaInterpreter* pLuaInterpreter = host.getLuaInterpreter();

auto [id, message] = pLuaInterpreter->setScriptCode(name, luaCode, pos);
auto [id, message] = pLuaInterpreter->setScriptCode(name, luaCode, --pos);
lua_pushnumber(L, id);
if (id == -1) {
lua_pushstring(L, message.toUtf8().constData());
Expand Down

0 comments on commit ff5e4e0

Please sign in to comment.