#[non_exhaustive]pub enum LuaVersion {
V51,
V52,
V53,
V54,
V55,
}Expand description
Which Lua language version a runtime instance speaks.
Default is LuaVersion::V54 — the version this codebase currently
implements end-to-end — so that Lua::new() and any other defaulted
construction keeps the existing 5.4 behavior.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
V51
Lua 5.1 — float-only, fenv-based globals. Deferred (separate core).
V52
Lua 5.2 — float-only, modern _ENV globals. Deferred (separate core).
V53
Lua 5.3 — dual subtype, modern _ENV. Deferred.
V54
Lua 5.4 — the implemented baseline today.
V55
Lua 5.5 — dual subtype, declared-globals scope model. Deferred.
Implementations§
Source§impl LuaVersion
impl LuaVersion
Sourcepub fn number_model(self) -> NumberModel
pub fn number_model(self) -> NumberModel
The family-level numeric model for this version.
Sourcepub fn honors_name_metafield(self) -> bool
pub fn honors_name_metafield(self) -> bool
Whether the __name metafield overrides an object’s type name (in
tostring and in type-error messages). __name is a 5.3 addition; 5.1
and 5.2 ignore it and always report the primitive type name.
Sourcepub fn lines_returns_to_be_closed(self) -> bool
pub fn lines_returns_to_be_closed(self) -> bool
Whether io.lines(filename, ...) returns the file as a fourth
to-be-closed result. The to-be-closed value (<close>) mechanism is a
5.4 addition: 5.4/5.5 return four values (iterator, nil, nil, file) so a
generic for can close the file on loop exit; 5.1–5.3 return only the
iterator (one value).
Sourcepub fn is_supported(self) -> bool
pub fn is_supported(self) -> bool
Whether this version has a real backend. The modern family (5.3/5.4/5.5)
and 5.2 (float-only + _ENV) are complete. 5.1 reuses the 5.2 float-only
core plus three faithful 5.1-specific axes:
- fenv globals —
getfenv/setfenv(the per-function environment model, Option B over the reused_ENVupvalue;specs/followup/5.1-fenv.md). - metamethod diffs —
#tnever consults a table__len, no__pairs/__ipairs, no__gcon tables (userdata only). - roster + syntax —
unpackis global (notable.unpack/pack/move);loadstring+ reader-onlyload;table.getn/setn(stub)/maxn/foreach/foreachi;module/package.seeall/package.loaders(nopackage.searchers);string.gfind;math.log1-arg +log10/atan2/pow/mod(nomath.type);gcinfo;newproxy;xpcall-no-extra-args;coroutine.runningnil in main; nobit32/utf8/rawlen;goto/labels////bitwise/<const>/\x-\zescapes rejected (gotostays a valid identifier). Seespecs/followup/5.1-roster-syntax.md. Documented divergences: themath.randomC-rand()sequence andos.executeraw-status byte are host-dependent (contract matches; exact bytes do not).
Sourcepub fn version_str(self) -> &'static str
pub fn version_str(self) -> &'static str
The _VERSION global string for this version (e.g. "Lua 5.4").
Sourcepub fn luac_version_byte(self) -> u8
pub fn luac_version_byte(self) -> u8
The LUAC_VERSION byte written into a luac/string.dump header for
this version. Upstream encodes the version as (major << 4) | minor,
e.g. 5.4 → 0x54.
Sourcepub fn supports(self, f: Feature) -> bool
pub fn supports(self, f: Feature) -> bool
Whether this version has a given language Feature — the pure,
build-independent capability matrix (issue #234). This is the version
dimension only; an embedding instance additionally narrows
library-backed features by what was compiled in (see
omnilua::Lua::supports).
The rows are the source of record ANALYSES/version_feature_matrix.tsv,
generated by probing the reference binaries
(specs/oracle/gen_feature_matrix.sh); a test asserts this function
against that fixture so the matrix can never drift from upstream.
Trait Implementations§
Source§impl Clone for LuaVersion
impl Clone for LuaVersion
Source§fn clone(&self) -> LuaVersion
fn clone(&self) -> LuaVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more