Platform API
Platform detection helpers are available under ptool.platform and p.platform.
ptool.platform.os
v0.1.0- Introduced.
ptool.platform.os() returns the operating system of the current machine.
- Returns:
linux | macos | windows.
print(ptool.platform.os()) -- macos
Behavior:
- This reports the local machine running
ptool run. - Only
linux,macos, andwindowsare supported.
ptool.platform.arch
v0.1.0- Introduced.
ptool.platform.arch() returns the CPU architecture of the current machine.
- Returns:
amd64 | arm64.
print(ptool.platform.arch()) -- arm64
Behavior:
x86_64is exposed asamd64.aarch64is exposed asarm64.- Only
x86_64andaarch64are supported byptool.
ptool.platform.target
v0.1.0- Introduced.
ptool.platform.target() returns a normalized platform target string for the
current machine.
- Returns:
string.
local target = ptool.platform.target()
print(target) -- macos-arm64
Behavior:
- The result is always
ptool.platform.os() .. "-" .. ptool.platform.arch(). - This is intended for platform-based branching such as selecting download artifacts.