split lua stubs into one set for ldoc, and one set for lua-ls

This commit is contained in:
jacqueline
2024-01-05 17:15:47 +11:00
parent aa1dd3d522
commit e12a68a74d
24 changed files with 206 additions and 79 deletions
+13
View File
@@ -0,0 +1,13 @@
--- Module for interacting with playback volume. The Bluetooth and wired outputs store their current volume separately; this API only allows interacting with the volume of the currently used output device.
-- @module alerts
local alerts = {}
--- Returns the current volume as a percentage of the current volume limit.
-- @tparam function constructor Called to create the UI for the alert. A new default root object and group will be set before calling this function.i Alerts are non-interactable; the group created for the constructor will not be granted focus.
function alerts.show(constructor) end
--- Dismisses any visible alerts, removing them from the screen.
function alerts.hide() end
return alerts
+13
View File
@@ -0,0 +1,13 @@
--- Module for adding and removing screens from the system's backstack.
-- @module backstack
local backstack = {}
--- Pushes a new screen onto the backstack.
-- @tparam function constructor Called to create the UI for the new screen. A new default root object and group will be set before calling this function. The function provided should return a table holding any bindings used by this screen; the returned value is retained so long as this screen is present in the backstack.
function backstack.push(constructor) end
--- Removes the currently active screen, and instead shows the screen underneath it on the backstack. Does nothing if this is the only existing screen.
function backstack.pop() end
return backstack
+13
View File
@@ -0,0 +1,13 @@
--- Properties and functions for handling Bluetooth connectivity
-- @module bluetooth
local bluetooth = {}
--- Whether or not the Bluetooth stack is currently enabled. This property is writeable, and can be used to enable or disable Bluetooth.
-- @see types.Property
bluetooth.enabled = types.Property
--- Whether or not there is an active connection to another Bluetooth device.
-- @see types.Property
bluetooth.connected = types.Property
return bluetooth
+59
View File
@@ -0,0 +1,59 @@
--- Module for accessing and updating data about the user's library of tracks.
-- @module database
local database = {}
--- Returns a list of all indexes in the database.
-- @treturn Array(Index)
function database.indexes() end
--- An iterator is a userdata type that behaves like an ordinary Lua iterator.
-- @type Iterator
local Iterator = {}
--- A TrackId is a unique identifier, representing a playable track in the
--- user's library.
-- @type TrackId
local TrackId = {}
--- A record is an item within an Index, representing some value at a specific
--- depth.
-- @type Record
local Record = {}
--- Gets the human-readable text representing this record. The `__tostring`
--- metatable function is an alias of this function.
-- @treturn string
function Record:title() end
--- Returns the value that this record represents. This may be either a track
--- id, for records which uniquely identify a track, or it may be a new
--- Iterator representing the next level of depth for the current index.
---
--- For example, each Record in the "All Albums" index corresponds to an entire
--- album of tracks; the 'contents' of such a Record is an iterator returning
--- each track in the album represented by the Record. The contents of each of
--- the returned 'track' Records would be a full Track, as there is no further
--- disambiguation needed.
-- @treturn TrackId|Iterator(Record)
function Record:contents() end
--- An index is heirarchical, sorted, view of the tracks within the database.
--- For example, the 'All Albums' index contains, first, a sorted list of every
--- album name in the library. Then, at the second level of the index, a sorted
--- list of every track within each album.
-- @type Index
local Index = {}
--- Gets the human-readable name of this index. This is typically something
--- like "All Albums", or "Albums by Artist". The `__tostring` metatable
--- function is an alias of this function.
-- @treturn string
function Index:name() end
--- Returns a new iterator that can be used to access every record within the
--- first level of this index.
-- @treturn Iterator(Record)
function Index:iter() end
return database
+19
View File
@@ -0,0 +1,19 @@
--- Properties for interacting with the audio playback system
-- @module playback
local playback = {}
--- Whether or not any audio is *allowed* to be played. If there is a current track, then this is essentially an indicator of whether playback is paused or unpaused.
-- @see types.Property
playback.playing = types.Property
--- Rich information about the currently playing track.
-- @see types.Property
-- @see types.Track
playback.track = types.Property
--- The current playback position within the current track, in seconds.
-- @see types.Property
playback.position = types.Property
return playback
+18
View File
@@ -0,0 +1,18 @@
--- Properties and functions that deal with the device's battery and power state
-- @module power
local power = {}
--- The battery's current charge as a percentage
-- @see types.Property
power.battery_pct = types.Property
--- The battery's current voltage, in millivolts.
-- @see types.Property
power.battery_millivolts = types.Property
--- Whether or not the device is currently receiving external power
-- @see types.Property
power.plugged_in = types.Property
return power
+22
View File
@@ -0,0 +1,22 @@
--- Properties and functions for inspecting and manipulating the track playback queue
-- @module queue
local queue = {}
--- The index in the queue of the currently playing track. This may be zero if the queue is empty.
-- @see types.Property
queue.position = types.Property
--- The total number of tracks in the queue, including tracks which have already been played.
-- @see types.Property
queue.size = types.Property
--- Determines whether or not the queue will be restarted after the final track is played.
-- @see types.Property
queue.replay = types.Property
--- Determines whether, when progressing to the next track in the queue, the next track will be chosen randomly. The random selection algorithm used is a Miller Shuffle, which guarantees that no repeat selections will be made until every item in the queue has been played.
-- @see types.Property
queue.random = types.Property
return queue
+35
View File
@@ -0,0 +1,35 @@
--- Userdata-based types used throughout the rest of the API. These types are
--- not generally constructable within Lua code.
-- @module types
local types = {}
--- A observable value, owned by the C++ firmware.
-- @type Property
types.Property = {}
--- Gets the current value
-- @return The property's current value.
function Property:get() end
--- Sets a new value. Not all properties may be set from within Lua code. For
--- example, it makes little sense to attempt to override the current battery
--- level.
-- @param val The new value. This should generally be of the same type as the existing value.
-- @return true if the new value was applied, or false if the backing C++ code rejected the new value (e.g. if it was out of range, or the wrong type).
function Property:set(val) end
--- Invokes the given function once immediately with the current value, and then again whenever the value changes.
--- The function is invoked for *all* changes; both from the underlying C++ data, and from calls to `set` (if this is a Lua-writeable property).
--- The binding will be active **only** so long as the given function remains in scope.
-- @param fn callback function to apply property values. Must accept one argument; the updated value.
-- @return fn, for more ergonmic use with anonymous closures.
function Property:bind(fn) end
--- Table containing information about a track. Most fields are optional.
-- @type Track
types.Track = {}
--- The title of the track, or the filename if no title is available.
types.Track.title = ""
return Property
+14
View File
@@ -0,0 +1,14 @@
--- Module for interacting with playback volume. The Bluetooth and wired outputs store their current volume separately; this API only allows interacting with the volume of the currently used output device.
-- @module volume
local volume = {}
--- The current volume as a percentage of the current volume limit.
-- @see types.Property
volume.current_pct = types.Property
--- The current volume in terms of decibels relative to line level.
-- @see types.Property
volume.current_db = types.Property
return volume