lovr.headset.getDriver accepts devices;

This commit is contained in:
bjorn 2019-05-08 04:10:22 -07:00
parent 5413f6a427
commit 57321db2cd
1 changed files with 13 additions and 2 deletions

View File

@ -132,8 +132,19 @@ static Device luax_optdevice(lua_State* L, int index) {
}
static int l_lovrHeadsetGetDriver(lua_State* L) {
lua_pushstring(L, HeadsetDrivers[lovrHeadsetDriver->driverType]);
return 1;
if (lua_gettop(L) == 0) {
lua_pushstring(L, HeadsetDrivers[lovrHeadsetDriver->driverType]);
return 1;
} else {
Device device = luax_optdevice(L, 1);
FOREACH_TRACKING_DRIVER(driver) {
if (driver->getPose(device, NULL, NULL)) {
lua_pushstring(L, HeadsetDrivers[driver->driverType]);
return 1;
}
}
}
return 0;
}
static int l_lovrHeadsetGetName(lua_State* L) {