Skip to main content

LuaVersion

Enum LuaVersion 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

pub fn number_model(self) -> NumberModel

The family-level numeric model for this version.

Source

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 globalsgetfenv/setfenv (the per-function environment model, Option B over the reused _ENV upvalue; specs/followup/5.1-fenv.md).
  • metamethod diffs#t never consults a table __len, no __pairs/__ipairs, no __gc on tables (userdata only).
  • roster + syntaxunpack is global (no table.unpack/pack/ move); loadstring + reader-only load; table.getn/setn(stub)/ maxn/foreach/foreachi; module/package.seeall/package.loaders (no package.searchers); string.gfind; math.log 1-arg + log10/atan2/pow/mod (no math.type); gcinfo; newproxy; xpcall-no-extra-args; coroutine.running nil in main; no bit32/ utf8/rawlen; goto/labels////bitwise/<const>/\x-\z escapes rejected (goto stays a valid identifier). See specs/followup/5.1-roster-syntax.md. Documented divergences: the math.random C-rand() sequence and os.execute raw-status byte are host-dependent (contract matches; exact bytes do not).
Source

pub fn version_str(self) -> &'static str

The _VERSION global string for this version (e.g. "Lua 5.4").

Source

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.

Trait Implementations§

Source§

impl Clone for LuaVersion

Source§

fn clone(&self) -> LuaVersion

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for LuaVersion

Source§

impl Debug for LuaVersion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LuaVersion

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for LuaVersion

Source§

impl Hash for LuaVersion

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LuaVersion

Source§

fn eq(&self, other: &LuaVersion) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for LuaVersion

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.