Home>

I am developing with lua using cocos2d-x,
I wanted to determine the OS and wanted to use CC_TARGET_PLATFORM.
I didn't understand how to write in lua.

Is there anyone who knows?

  • Answer # 1

    local targetPlatform = cc.Application: getInstance (): getTargetPlatform ()
    if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then
    ...
    end

Related articles