1. Bart van Strien
  2. nlove

Commits

Bart van Strien  committed e1f13f7

Make most Source setters default their z coordinate to 0, instead of erroring in its absence (issue #423)

  • Participants
  • Parent commits 72f7166
  • Branches default

Comments (0)

Files changed (2)

File src/modules/audio/wrap_Audio.cpp

View file
 		float v[3];
 		v[0] = (float)luaL_checknumber(L, 1);
 		v[1] = (float)luaL_checknumber(L, 2);
-		v[2] = (float)luaL_checknumber(L, 3);
+		v[2] = (float)luaL_optnumber(L, 3, 0);
 		instance->setPosition(v);
 		return 0;
 	}
 		float v[3];
 		v[0] = (float)luaL_checknumber(L, 1);
 		v[1] = (float)luaL_checknumber(L, 2);
-		v[2] = (float)luaL_checknumber(L, 3);
+		v[2] = (float)luaL_optnumber(L, 3, 0);
 		instance->setVelocity(v);
 		return 0;
 	}

File src/modules/audio/wrap_Source.cpp

View file
 		float v[3];
 		v[0] = (float)luaL_checknumber(L, 2);
 		v[1] = (float)luaL_checknumber(L, 3);
-		v[2] = (float)luaL_checknumber(L, 4);
+		v[2] = (float)luaL_optnumber(L, 4, 0);
 		t->setPosition(v);
 		return 0;
 	}
 		float v[3];
 		v[0] = (float)luaL_checknumber(L, 2);
 		v[1] = (float)luaL_checknumber(L, 3);
-		v[2] = (float)luaL_checknumber(L, 4);
+		v[2] = (float)luaL_optnumber(L, 4, 0);
 		t->setVelocity(v);
 		return 0;
 	}
 		float v[3];
 		v[0] = (float)luaL_checknumber(L, 2);
 		v[1] = (float)luaL_checknumber(L, 3);
-		v[2] = (float)luaL_checknumber(L, 4);
+		v[2] = (float)luaL_optnumber(L, 4, 0);
 		t->setDirection(v);
 		return 0;
 	}