Skip to main content

LuaVersion

Enum LuaVersion 

Source
pub enum LuaVersion {
    Lua51,
    Lua52,
    Lua53,
    Lua54,
    MacroLua,
    Lua55,
}
Expand description

Lua dialect the VM emulates. Drives lexer, parser, and runtime feature gating. Lua55 is the primary; the others are compat modes; MacroLua (v1.3 Phase ML) is an additive dialect built on top of the 5.4 base.

Enum ordering note: MacroLua is placed between Lua54 and Lua55 on purpose. The capability predicates below use >= / <= comparisons; placing MacroLua immediately after Lua54 means MacroLua inherits every 5.4-and-earlier capability for free while staying below the 5.5-only gate (global keyword, named vararg).

Variants§

§

Lua51

Lua 5.1 — no integer subtype, arg table, no goto.

§

Lua52

Lua 5.2 — adds goto / bit32 / \xXX escapes, retires setfenv.

§

Lua53

Lua 5.3 — adds native 64-bit integers, bitwise ops, string.pack.

§

Lua54

Lua 5.4 — adds <const> / <close> attributes and integer-for spec.

§

MacroLua

MacroLua (v1.3 Phase ML) — 5.4 base + compile-time macros (@name(args), @quote{...}, @if, @gensym). Opt-in via Vm::new(LuaVersion::MacroLua); PUC 5.1-5.5 lexer/parser behavior is not affected. See docs/compatibility.md “MacroLua extensions”.

§

Lua55

Lua 5.5 — adds global declarations and named vararg parameters.

Implementations§

Source§

impl LuaVersion

Source

pub fn has_integers(self) -> bool

Integer subtype and integer literals (5.3+).

Source

pub fn has_goto(self) -> bool

goto / ::label:: (5.2+); goto is a reserved word.

Source

pub fn has_bitwise_ops(self) -> bool

& | ~ << >> operators (5.3+).

Source

pub fn has_idiv(self) -> bool

// floor division (5.3+).

Source

pub fn has_attribs(self) -> bool

<const> / <close> attributes on local declarations (5.4+).

Source

pub fn has_hex_float(self) -> bool

Hexadecimal float literals 0x1p4 (5.2+).

Source

pub fn has_extended_escapes(self) -> bool

String escapes \z, \xXX (5.2+) and \u{XXX} (5.3+).

Source

pub fn has_unicode_escape(self) -> bool

\u{XXX} unicode escape specifically (5.3+).

Source

pub fn has_empty_statement(self) -> bool

Empty statement ; (5.2+).

Source

pub fn has_global_decl(self) -> bool

global declarations; global is a reserved word (5.5+).

Source

pub fn has_named_vararg(self) -> bool

Named vararg parameter function f(...name) (5.5+).

Source

pub fn has_collective_attrib(self) -> bool

Leading collective attribute in declarations: local <const> a, b (5.5+).

Source

pub fn break_is_last_statement(self) -> bool

In 5.1 break is a “last statement” like return; later versions allow it anywhere in a block.

Source

pub fn rejects_nested_long_string(self) -> bool

In 5.1, [[ inside a level-0 long string is an error (“nesting of [[…]] is deprecated”).

Source

pub fn is_macro_lua(self) -> bool

MacroLua dialect — compile-time macros enabled in lexer/parser. Base semantics = Lua 5.4 (audit-locked, v1.3 Phase ML).

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 Eq for LuaVersion

Source§

impl Ord for LuaVersion

Source§

fn cmp(&self, other: &LuaVersion) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. 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 PartialOrd for LuaVersion

Source§

fn partial_cmp(&self, other: &LuaVersion) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
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.