Merge pull request #217 from boxmein/getpartindex-fix

luatpt_getPartIndex no longer returns a valid particle index when next_getPartIndex is false.
This commit is contained in:
jacob1 2014-06-18 10:10:56 -04:00
commit 25085b739f

View File

@ -1761,7 +1761,7 @@ int luatpt_next_getPartIndex(lua_State* l)
getPartIndex_curIdx++; getPartIndex_curIdx++;
if (getPartIndex_curIdx >= NPART) if (getPartIndex_curIdx >= NPART)
{ {
getPartIndex_curIdx = 0; getPartIndex_curIdx = -1;
lua_pushboolean(l, 0); lua_pushboolean(l, 0);
return 1; return 1;
} }
@ -1778,7 +1778,7 @@ int luatpt_getPartIndex(lua_State* l)
{ {
if(getPartIndex_curIdx < 0) if(getPartIndex_curIdx < 0)
{ {
lua_pushinteger(l, 0); lua_pushinteger(l, -1);
return 1; return 1;
} }
lua_pushinteger(l, getPartIndex_curIdx); lua_pushinteger(l, getPartIndex_curIdx);