system.getVersion¶
since 1.1.0
Return Ethos version.
Parameters¶
None.
Returns¶
Table with elements:
board(string) board name, i.e. "X20S"version(string) versionmajor(number) version major (i.e. 1 if version is "1.2.0-RC1")minor(number) version minor (i.e. 2 if version is "1.2.0-RC1")revision(number) version revision (i.e. 0 if version is "1.2.0-RC1")suffix(string) version suffix (i.e. "RC1" if version is "1.2.0-RC1")lcdWidth(number) LCD WidthlcdHeight(number) LCD Heightsimulation(boolean)serial(string)
Examples¶
local v = system.getVersion()
print(v.board, v.version, v.major, v.minor, v.revision, v.lcdWidth, v.lcdHeight, v.simulation)
-- feature gate: 1.6 or newer (26.x counts as newer)
local function atLeast(major, minor)
return v.major > major or (v.major == major and v.minor >= minor)
end
-- behave differently in the simulator (e.g. fake telemetry)
if v.simulation then
-- ...
end
Prefer feature checks (if system.getSources then) over version checks where possible: they also work on builds you didn't anticipate.
Used in¶
Real-world usage¶
Called 67 times across 9 open-source Ethos Lua projects. A few short excerpts: