Browse Source

love.graphics.newIndexBuffer uses 0-based index values.

It can't be consistent with other buffer types or Buffer methods if it's 1-based.
Alex Szpakowski 5 years ago
parent
commit
3c65d5ae41
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/modules/graphics/wrap_Graphics.cpp

+ 2 - 2
src/modules/graphics/wrap_Graphics.cpp

@@ -1734,7 +1734,7 @@ int w_newIndexBuffer(lua_State *L)
 		for (size_t i = 0; i < arraylength; i++)
 		for (size_t i = 0; i < arraylength; i++)
 		{
 		{
 			lua_rawgeti(L, 1, i + 1);
 			lua_rawgeti(L, 1, i + 1);
-			lua_Integer v = luaL_checkinteger(L, -1) - 1;
+			lua_Integer v = luaL_checkinteger(L, -1);
 			lua_pop(L, 1);
 			lua_pop(L, 1);
 			if (v < 0)
 			if (v < 0)
 				return luaL_argerror(L, 1, "expected positive integer values in array");
 				return luaL_argerror(L, 1, "expected positive integer values in array");
@@ -1771,7 +1771,7 @@ int w_newIndexBuffer(lua_State *L)
 		for (size_t i = 0; i < arraylength; i++)
 		for (size_t i = 0; i < arraylength; i++)
 		{
 		{
 			lua_rawgeti(L, 1, i + 1);
 			lua_rawgeti(L, 1, i + 1);
-			lua_Integer v = luaL_checkinteger(L, -1) - 1;
+			lua_Integer v = luaL_checkinteger(L, -1);
 			lua_pop(L, 1);
 			lua_pop(L, 1);
 			if (format == DATAFORMAT_UINT16)
 			if (format == DATAFORMAT_UINT16)
 				u16data[i] = (uint16) v;
 				u16data[i] = (uint16) v;