– The utils object. local utils = {
-- Are we running in the simulator? isSimulator = false, -- Are we running on an iOS device? isIOS = false, -- Are we running on an Android device? isAndroid = false, -- Are we running on a Windows desktop? isWin = false, -- Are we running on a Mac OS X desktop? isMac = false
};
– Set various flags in utils object. if string.lower(system.getInfo(“environment”)) == “simulator” then
utils.isSimulator = true;
end if string.lower(system.getInfo(“platformName”)) == “iphone os” then
utils.isIOS = true;
end if string.lower(system.getInfo(“platformName”)) == “android” then
utils.isAndroid = true;
end if string.lower(system.getInfo(“platformName”)) == “win” then
utils.isWin = true;
end if string.lower(system.getInfo(“platformName”)) == “mac os x” then
utils.isMac = true;
end
– ============================================================================ – Simple common logging function. Note that this uses json.encode(), which – sometimes won’t properly encode user data.