Skip to content

Commit 326136b

Browse files
committed
Add app.os object
1 parent 66d96df commit 326136b

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-1
lines changed

Changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ else
2424
end
2525
```
2626

27+
## v1.3.7
28+
29+
* [`app.apiVersion`](api/app.md#appapiversion) is `28`
30+
* New [`app.os`](api/app_os.md#appos) with some properties about the running platform
31+
2732
## v1.3.3
2833

2934
* [`app.apiVersion`](api/app.md#appapiversion) is `27`

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018 Igara Studio S.A.
1+
Copyright (c) 2018-2024 Igara Studio S.A.
22
Copyright (c) 2015-2018 David Capello
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Globals namespaces
4141
* [app](api/app.md#app)
4242
* [app.command](api/app_command.md#appcommand)
4343
* [app.fs](api/app_fs.md#appfs)
44+
* [app.os](api/app_os.md#appos)
4445
* [app.pixelColor](api/pixelcolor.md#apppixelcolor)
4546
* [app.theme](api/app_theme.md#apptheme)
4647
* [json](api/json.md#json)

api/app_os.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# app.os
2+
3+
A set of function to get properties about the running Operating System
4+
platform.
5+
6+
## app.os.name
7+
8+
```lua
9+
local name = app.os.name
10+
```
11+
12+
Returns the platform name. It can be `Windows`, `macOS`, or `Linux`.
13+
14+
## app.os.version
15+
16+
Returns an [`Version`](version.md#version) with the Windows or macOS
17+
version. It's just `0.0.0` on Linux.
18+
19+
## app.os.fullName
20+
21+
Returns the full platform name with its version. On Linux returns the
22+
distribution name with its specific version.
23+
24+
Some examples: `Windows NT 10.0.22631`, `macOS 14.4.1`, `Pop!_OS 22.04 LTS`, etc.
25+
26+
## app.os.windows
27+
## app.os.macos
28+
## app.os.linux
29+
## app.os.x64
30+
## app.os.x86
31+
## app.os.arm64
32+
33+
These are `true`/`false` properties if we are running in the given
34+
platform. For example:
35+
36+
```lua
37+
if app.os.windows then
38+
print("Running on Windows")
39+
elseif app.os.macos then
40+
if app.os.arm64 then
41+
print("Running on Apple Silicon")
42+
end
43+
end
44+
```

sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Globals namespaces
77
* [app](api/app.md#app)
88
* [app.command](api/app_command.md#appcommand)
99
* [app.fs](api/app_fs.md#appfs)
10+
* [app.os](api/app_os.md#appos)
1011
* [app.pixelColor](api/pixelcolor.md#apppixelcolor)
1112
* [app.theme](api/app_theme.md#apptheme)
1213
* [json](api/json.md#json)

0 commit comments

Comments
 (0)