|
@@ -71,10 +71,11 @@ int w_Source_setPitch(lua_State *L)
|
|
|
{
|
|
|
Source *t = luax_checksource(L, 1);
|
|
|
float p = (float)luaL_checknumber(L, 2);
|
|
|
+ if (p != p)
|
|
|
+ return luaL_error(L, "Pitch cannot be NaN.");
|
|
|
if (p > std::numeric_limits<lua_Number>::max() ||
|
|
|
- p < std::numeric_limits<lua_Number>::min() ||
|
|
|
- p != p)
|
|
|
- return luaL_error(L, "Pitch has to be finite and not NaN.");
|
|
|
+ p <= 0.0f)
|
|
|
+ return luaL_error(L, "Pitch has to be non-zero, positive, finite number.");
|
|
|
t->setPitch(p);
|
|
|
return 0;
|
|
|
}
|