How can I check what device the user is using?

I’m working on an app, and I’d like different layouts for iPhone and iPad. How can I accomplish that?

Try device.metrics. See this link.

https://codea.io/talk/discussion/6986/font-size-on-different-devices

@Zenon Try this. Also, do a forum search on deviceMetrics.

function setup()
    for a,b in pairs(deviceMetrics()) do
        print(a,b)
    end
end

Thanks. deviceMetrics().platform returns iPad4,7 while deviceMetrics().platformType returns iPad 4G. Not sure where the first one comes from, because I’m on an iPad mini 3.

@Zenon
Google is your friend. See the chart here for how to read devicemetrics:

http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x-tvos/ios-device-types