How to detect if the game runs on Windows?

I think I have read this somewhere but can’t find it now :frowning:

system.getInfo( “platformName”) ?

What does it return?

Have a look at our brand new sample project “Interface/DesktopWindow” that’s included with the Corona SDK.  Near the top of it’s “main.lua” file, it checks if the app is running as a desktop window on the OS X or Win32 platforms.  In summary, the code looks like this…

-- Determine if this app is running in a desktop window. local isRunningOnDesktop = false if (system.getInfo("environment") == "device") then local platformName = system.getInfo("platformName") if (platformName == "Win") or (platformName == "Mac OS X") then isRunningOnDesktop = true end end

So, yes, you should call system.getInfo(“platformName”) to determine if you are running on OS X or Windows… *but* this API will do the same within the Corona Simulator when simulating a device.  So, you need to also call the system.getInfo(“environment”) to determine if you are running in the simulator or on the actual device (ie: intended platform).

I hope this helps!

Have a look at our brand new sample project “Interface/DesktopWindow” that’s included with the Corona SDK.  Near the top of it’s “main.lua” file, it checks if the app is running as a desktop window on the OS X or Win32 platforms.  In summary, the code looks like this…

-- Determine if this app is running in a desktop window. local isRunningOnDesktop = false if (system.getInfo("environment") == "device") then local platformName = system.getInfo("platformName") if (platformName == "Win") or (platformName == "Mac OS X") then isRunningOnDesktop = true end end

So, yes, you should call system.getInfo(“platformName”) to determine if you are running on OS X or Windows… *but* this API will do the same within the Corona Simulator when simulating a device.  So, you need to also call the system.getInfo(“environment”) to determine if you are running in the simulator or on the actual device (ie: intended platform).

I hope this helps!