Skip to content

Commit 6175064

Browse files
committed
os.dnsresolve
1 parent 322bed7 commit 6175064

File tree

1 file changed

+14
-0
lines changed
  • docs/Runtime Environment

1 file changed

+14
-0
lines changed

docs/Runtime Environment/OS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,26 @@ This page documents the changes & additions to the `os` library in Pluto, which
1616
```pluto
1717
os.sleep(1000) -- Pause this thread for 1000ms.
1818
```
19+
1920
---
2021
### `os.nanos`, `os.micros`, `os.millis`, `os.seconds`
2122
All of these return their respective times since implementation-specific epoch.
2223
### `os.unixseconds`
2324
Returns seconds since UNIX epoch.
2425

26+
---
27+
### `os.dnsresolve`
28+
Asks the operating system to perform a DNS lookup.
29+
#### Parameters
30+
1. The DNS record type, e.g. `"A"` for IPv4 or `"AAAA"` for IPv6.
31+
2. The domain name to query.
32+
#### Return
33+
An array of tables describing each record. Each table contains a `type` and `data` field.
34+
#### Example
35+
```pluto norun
36+
print(dumpvar(os.dnsresolve("A", "one.one.one.one"))) -- { { type = "A", data = "1.1.1.1" }, { type = "A", data = "1.0.0.1" } }
37+
```
38+
Not available on Android/Termux or WASM builds of Pluto.
2539

2640
---
2741
### `os.rename`, `os.remove`

0 commit comments

Comments
 (0)