Wiki

Clone wiki

Core / deviceMetrics

Back to Beyond the Codea in-app reference


FunctionIconFunction-Small.png deviceMetrics()

Introduction

Codea's in-app reference does not document the deviceMetrics() function. The function returns a table with information about the device on which Codea is running:

myDevice = deviceMetrics()
myDevice.hwmodel      -- (string) the hardware (hw) model
myDevice.platform     -- (string) the platform
myDevice.platformName -- (string) a description of the platform

Some parts of Codea's API make use of hardware features not available on an iPad 1G.

deviceMetrics().hwmodel

Examples of hardware models are:

K48AP -- iPad1,1
K93AP -- iPad2,1
K94AP -- iPad2,2
K95AP -- iPad2,3
J1AP  -- iPad3,1
J2AP  -- iPad3,2

deviceMetrics().platform

Examples of platforms are:

iPad1,1 -- iPad 1G, WiFi or GSM, K48AP
iPad2,1 -- iPad 2G, WiFi, K93AP
iPad2,2 -- iPad 2G, GSM 3G, K94AP
iPad2,3 -- iPad 2G, CDMA 3G, K95AP
iPad3,1 -- iPad 3G, Wi-Fi, J1AP
iPad3,2 -- iPad 3G, GSM+CDMA, J2AP

deviceMetrics().platformName

Examples of platform names are:

iPad 1G
iPad 2G
iPad 3G

Updated