Fixed love.audio.newSource(SoundData) variant.

This commit is contained in:
Miku AuahDark
2022-05-28 19:17:50 +08:00
parent 2822f17a39
commit 9e1e35ff39
+4 -1
View File
@@ -48,7 +48,9 @@ int w_newSource(lua_State *L)
{ {
Source::Type stype = Source::TYPE_STREAM; Source::Type stype = Source::TYPE_STREAM;
if (!luax_istype(L, 1, love::sound::SoundData::type) && !luax_istype(L, 1, love::sound::Decoder::type)) if (!luax_istype(L, 1, love::sound::SoundData::type))
{
if (!luax_istype(L, 1, love::sound::Decoder::type))
{ {
const char *stypestr = luaL_checkstring(L, 2); const char *stypestr = luaL_checkstring(L, 2);
if (stypestr && !Source::getConstant(stypestr, stype)) if (stypestr && !Source::getConstant(stypestr, stype))
@@ -75,6 +77,7 @@ int w_newSource(lua_State *L)
int idxs[] = { 1, lua_gettop(L), lua_gettop(L) - 1 }; int idxs[] = { 1, lua_gettop(L), lua_gettop(L) - 1 };
luax_convobj(L, idxs, 3, "sound", "newDecoder"); luax_convobj(L, idxs, 3, "sound", "newDecoder");
} }
}
if (stype == Source::TYPE_STATIC && luax_istype(L, 1, love::sound::Decoder::type)) if (stype == Source::TYPE_STATIC && luax_istype(L, 1, love::sound::Decoder::type))
luax_convobj(L, 1, "sound", "newSoundData"); luax_convobj(L, 1, "sound", "newSoundData");