nicer assert in sound data append

This commit is contained in:
Nevyn Bengtsson 2020-12-15 10:32:00 +01:00 committed by Bjorn
parent 213c721d1f
commit 0d36cdd443
1 changed files with 2 additions and 1 deletions

View File

@ -13,12 +13,13 @@ static int l_lovrSoundDataAppend(lua_State* L) {
SoundData* soundData = luax_checktype(L, 1, SoundData);
Blob* blob = luax_totype(L, 2, Blob);
SoundData* sound = luax_totype(L, 2, SoundData);
lovrAssert(blob || sound, "Invalid blob appended");
size_t appendedSamples = 0;
if (sound) {
appendedSamples = lovrSoundDataStreamAppendSound(soundData, sound);
} else if (blob) {
appendedSamples = lovrSoundDataStreamAppendBlob(soundData, blob);
} else {
luaL_argerror(L, 2, "Invalid blob appended");
}
lua_pushinteger(L, appendedSamples);
return 1;