Files
esp32-lua-api/lua/api/core/sys.lua
T
evan 26f3fdb6e6 feat(runtime)!: sys.startApp replaces routing, history and app identity
The runtime kept a back stack, a launcher fallback, an app id and a title
because a teardown destroys the Lua that would otherwise hold them. Only
the first of those is true: everything about where an app came from can
ride in the arguments, and the arguments are the one value that has to
outlive the VM.

So the runtime now does four things -- close the state, load a path, hand
the next state its arguments, defer the swap to a batch boundary -- and
sys.startApp(path, args) is the whole of navigation. Routing, history,
titles and data directories move to the Lua file a firmware boots, where
they can differ per product without a flag on Runtime.

Arguments cross as JSON, encoded while the sending state still holds the
table, so a function or a cycle raises at the call rather than stranding
a launch. start(args) receives the decoded table, or nil at boot, which
is how the entry file knows to open its own launcher.

Removes launch, replace, back, canGoBack, getAppID, getAppTitle,
setAppTitle and getAppDataPath, along with the home and data fields.
LANDSCAPE.md goes with them: it recorded a divergence from firmwares that
have since migrated.
2026-08-05 17:04:35 -04:00

47 lines
1.4 KiB
Lua

---@meta
-- Generated from native/src/bindings/core/sys.cpp. Do not edit.
---@alias Feature "screen"|"touch"|"buttons"
---@class SysLib
sys = {}
---Returns the implemented API contract version.
---@return integer
function sys.getAPIVersion() end
---Whether the firmware implements a complete optional feature contract.
---@param feature Feature
---@return boolean
function sys.hasFeature(feature) end
---Returns monotonic milliseconds since boot.
---@return integer
function sys.getMillis() end
---Tears the runtime down and starts over from a Lua file, which is the only navigation there is: history, titles and where apps live are whatever that file makes of the arguments.
---@param path string Absolute path to the Lua file to load; traversal is rejected.
---@param args? table Plain data, carried across the teardown as JSON and handed to start(args). Raises on anything JSON cannot represent.
function sys.startApp(path, args) end
---Returns heap statistics.
---@return integer freeBytes
---@return integer totalBytes
---@return integer largestFreeBlock
function sys.getMemory() end
---Whether network time synchronization has completed.
---@return boolean
function sys.isClockSynced() end
---Returns the active POSIX timezone rule.
---@return string
function sys.getTimezone() end
---Applies and persists a POSIX timezone rule.
---@param timezone string
---@return true? ok
---@return string? error
function sys.setTimezone(timezone) end