Check IOS version

The new Codea looks great! However, (and there is always a “however”) we still have some iPad 1s here at school. Is there a way to check the IOS version in Codea so that I can exclude things like music on the iPad 1s.

I should have said that I’m running Codea on the iPad 1s and transferring my code to them. Hoping that some of the students will be interested in tinkering with the code.

Try using _VERSION.

print(_VERSION)

@DaveW it’s better to check for the specific functions, so for example, for music you can check if it exists as follows:

if music then
    -- We have music function, use it
end

However, if you really want to you can check the device info:

local model = deviceMetrics().platform

The model will be equal to something like “iPad1,2” — a string that represents a specific iteration of the hardware. This answer on StackOverflow has a mapping of platform names to hardware models:

http://stackoverflow.com/questions/12505414/whats-the-device-code-platform-string-for-iphone-5-5c-5s-ipod-touch-5

@dave1707 that will get the version of Lua, which will not differentiate between 2.0 and 1.5.5.

@Simeon @dave1707 I was just getting ready to say that _VERSION gave the Lua version. Testing for functions seems to be a much better idea. I am doing that for Cameras already, don’t know why it didn’t occur to me. Thanks a bunch.