Lua: fix setting chunk.position

Double decrement.
This commit is contained in:
Přemysl Eric Janouch 2017-01-26 19:42:52 +01:00
parent 6d81ea596b
commit 5934913790
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 2 additions and 2 deletions

4
hex.c
View File

@ -975,9 +975,9 @@ app_lua_chunk_newindex (lua_State *L)
}
else if (!strcmp (key, "position"))
{
lua_Integer position = luaL_checkinteger (L, 3) - 1;
lua_Integer position = luaL_checkinteger (L, 3);
if (position < 1 || position > self->len + 1)
return luaL_error (L, "position out of range: %" PRId64, position);
return luaL_error (L, "position out of range: %I", position);
self->position = position - 1;
}
else