diff options
author | Aylur <[email protected]> | 2024-09-14 11:59:09 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-14 11:59:09 +0200 |
commit | 45a3118f79970aebb561a31b050c2a63fc202c91 (patch) | |
tree | 5125d930cff745b93d579dc1d0e877af9ae405b4 /docs/libraries/bluetooth.md | |
parent | e9f9de6ba557de6a553f03de813af0fdbdbec047 (diff) | |
parent | 4d5c7a7b514c7f4f71b2950f051b64c3e3df3008 (diff) |
Merge pull request #9 from tokyob0t/main
Added examples for python and lua to the docs :nerd_face:
Diffstat (limited to 'docs/libraries/bluetooth.md')
-rw-r--r-- | docs/libraries/bluetooth.md | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/docs/libraries/bluetooth.md b/docs/libraries/bluetooth.md index 9aa7de7..04d9db2 100644 --- a/docs/libraries/bluetooth.md +++ b/docs/libraries/bluetooth.md @@ -69,19 +69,32 @@ bluetoothctl --help :::code-group ```js [<i class="devicon-javascript-plain"></i> JavaScript] -import Bluetooth from "gi://AstalBluetooth"; +import Bluetooth from "gi://AstalBluetooth" const bluetooth = Bluetooth.get_default() -console.log(bluetooth.get_devices().map(d => d.name)) +for (const device of bluetooth.get_devices()) { + print(device.name) +} ``` ```py [<i class="devicon-python-plain"></i> Python] -# Not yet documented +from gi.repository import AstalBluetooth as Bluetooth + +bluetooth = Bluetooth.get_default() + +for device in bluetooth.get_devices(): + print(device.get_name()) ``` ```lua [<i class="devicon-lua-plain"></i> Lua] --- Not yet documented +local Bluetooth = require("lgi").require("AstalBluetooth") + +local bluetooth = Bluetooth.get_default() + +for _, d in ipairs(bluetooth.devices) do + print(d.name) +end ``` ```vala [<i class="devicon-vala-plain"></i> Vala] |