Fix crash with lovr.graphics.newMaterial;
@@ -786,8 +786,9 @@ int l_lovrGraphicsNewMaterial(lua_State* L) {
lovrMaterialSetTexture(material, TEXTURE_DIFFUSE, texture);
lovrRelease(&texture->ref);
} else if (lua_isuserdata(L, index)) {
- Texture* texture = luax_checktypeof(L, index++, Texture);
+ Texture* texture = luax_checktypeof(L, index, Texture);
lovrMaterialSetTexture(material, TEXTURE_DIFFUSE, texture);
+ index++;
}
if (lua_isnumber(L, index)) {
