summaryrefslogtreecommitdiff
path: root/docs/libraries/bluetooth.md
diff options
context:
space:
mode:
authorKevin <[email protected]>2024-09-14 04:15:27 -0300
committerKevin <[email protected]>2024-09-14 04:15:27 -0300
commitc2308daf897055e056a0a51fbc445f7902c2f90b (patch)
tree394e7a2603fb9cc061434829901cb3dfb4db6b6d /docs/libraries/bluetooth.md
parente9f9de6ba557de6a553f03de813af0fdbdbec047 (diff)
Added examples for python and lua
Diffstat (limited to 'docs/libraries/bluetooth.md')
-rw-r--r--docs/libraries/bluetooth.md24
1 files changed, 20 insertions, 4 deletions
diff --git a/docs/libraries/bluetooth.md b/docs/libraries/bluetooth.md
index 9aa7de7..e37593f 100644
--- a/docs/libraries/bluetooth.md
+++ b/docs/libraries/bluetooth.md
@@ -71,17 +71,33 @@ bluetoothctl --help
```js [<i class="devicon-javascript-plain"></i> JavaScript]
import Bluetooth from "gi://AstalBluetooth";
-const bluetooth = Bluetooth.get_default()
+const bluetooth = Bluetooth.get_default();
-console.log(bluetooth.get_devices().map(d => d.name))
+console.log(bluetooth.get_devices().map((d) => d.name));
```
```py [<i class="devicon-python-plain"></i> Python]
-# Not yet documented
+import gi
+
+gi.require_version("AstalBluetooth", "0.1")
+
+from gi.repository import AstalBluetooth
+
+bluetooth = AstalBluetooth.get_default()
+
+print("\n".join(d.get_name() for d in bluetooth.get_devices()))
```
```lua [<i class="devicon-lua-plain"></i> Lua]
--- Not yet documented
+local lgi = require("lgi")
+
+local AstalBluetooth = lgi.require("AstalBluetooth", "0.1")
+
+local bluetooth = AstalBluetooth.get_default()
+
+for _, d in ipairs(bluetooth.devices) do
+ print(d.name)
+end
```
```vala [<i class="devicon-vala-plain"></i> Vala]