Allow lovr.audio.setDevice(type, nil);

This commit is contained in:
bjorn 2021-03-04 18:19:05 -07:00
parent 0c3351331e
commit 058700f970
1 changed files with 1 additions and 2 deletions

View File

@ -77,9 +77,8 @@ static int l_lovrAudioGetDevices(lua_State *L) {
static int l_lovrAudioSetDevice(lua_State *L) {
AudioType type = luax_checkenum(L, 1, AudioType, "playback");
luaL_checkany(L, 2);
void* id = lua_touserdata(L, 2);
size_t size = luax_len(L, 2);
size_t size = id ? luax_len(L, 2) : 0;
Sound* sink = lua_isnoneornil(L, 3) ? NULL : luax_checktype(L, 3, Sound);
AudioShareMode shareMode = luax_checkenum(L, 4, AudioShareMode, "shared");
bool success = lovrAudioSetDevice(type, id, size, sink, shareMode);