From 7ab6a7e7d721bf9bd3145bdba229c699611922f7 Mon Sep 17 00:00:00 2001 From: boxmein Date: Fri, 13 Jun 2014 00:25:18 +0300 Subject: [PATCH] luatpt_getPartIndex now passes a negative (invalid) index when it fails --- src/lua/LegacyLuaAPI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua/LegacyLuaAPI.cpp b/src/lua/LegacyLuaAPI.cpp index 9eff92304..16bd68b2e 100644 --- a/src/lua/LegacyLuaAPI.cpp +++ b/src/lua/LegacyLuaAPI.cpp @@ -1761,7 +1761,7 @@ int luatpt_next_getPartIndex(lua_State* l) getPartIndex_curIdx++; if (getPartIndex_curIdx >= NPART) { - getPartIndex_curIdx = 0; + getPartIndex_curIdx = -1; lua_pushboolean(l, 0); return 1; } @@ -1778,7 +1778,7 @@ int luatpt_getPartIndex(lua_State* l) { if(getPartIndex_curIdx < 0) { - lua_pushinteger(l, 0); + lua_pushinteger(l, -1); return 1; } lua_pushinteger(l, getPartIndex_curIdx);