platform

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
the platform
platform()
Summary

Returns the name of the operating system LiveCode is running on.

Introduced1.0
Changes

Support for Web was added in version 8.0.0.

OSmac, windows, linux, ios, android, web
Platformsdesktop, server, mobile
Example
the platform
if the platform is "MacOS" then set the activatePalettes to true
Values
NameTypeDescription
return

"Win32", "MacOS", "Linux", "iphone", "android", or "web"

RelatedControl Structure: function
Object: stack
Glossary: return, OS X, engine, appearance, Unix, Mac OS, standalone application, behavior
Function: systemVersion, buildNumber, deleteRegistry, processor, MCISendString
Description

Use the platform function to change a stack's behavior or appearance depending on the operating system.

The platform function is compiled into each version of the LiveCode engine. This means that, for example, if you're developing on a Mac OS|Mac OS system and you build a standalone application for Linux, when you run the standalone application on a Linux system, the platform function returns "Linux".

The possible values returned by the platform function are:

  • "Win32" on any version of Windows
  • "Linux" on all Linux distributions
  • "MacOS" on any version of Mac OS X
  • "iphone" on iPhones, iPads and other iOS devices
  • "android" on smartphones, tablets and other Android devices
  • "web" when running in a web browser