Allow lovr.audio.setDevice(type, nil);
@@ -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);
