Skip to main content

LuaVersion

Trait LuaVersion 

Source
pub trait LuaVersion: 'static + Sealed {
Show 14 associated constants and 0 method const NAME: &'static str; const HAS_FLOOR_DIV: bool; const HAS_COMPOUND_ASSIGN: bool; const HAS_CONTINUE: bool; const HAS_IF_EXPR: bool; const HAS_STRING_INTERP: bool; const HAS_TYPE_ANNOTATIONS: bool; const HAS_ATTRIBUTES: bool; const HAS_GENERICS: bool; const HAS_EXPORT: bool; const HAS_GOTO: bool; const HAS_BITWISE_OPS: bool; const HAS_VARIABLE_ATTRIBUTES: bool; const HAS_CONST: bool;
}
Expand description

Describes which syntax features a Lua version supports.

This is a sealed trait; you cannot implement it for your own types. Pick one of the provided versions: Luau, Lua51, Lua52, Lua53, or Lua54.

Required Associated Constants§

Source

const NAME: &'static str

A display name for this version (e.g. "Lua 5.4", "Luau").

Source

const HAS_FLOOR_DIV: bool

// integer division operator.

Source

const HAS_COMPOUND_ASSIGN: bool

Compound assignment operators (+=, -=, etc.).

Source

const HAS_CONTINUE: bool

The continue keyword inside loops.

Source

const HAS_IF_EXPR: bool

Inline if cond then a else b expressions.

Source

const HAS_STRING_INTERP: bool

Backtick interpolated strings (`hello {name}`).

Source

const HAS_TYPE_ANNOTATIONS: bool

Type annotations (: Type, -> ReturnType).

Source

const HAS_ATTRIBUTES: bool

@native and similar function attributes.

Source

const HAS_GENERICS: bool

Generic type parameters (<T>).

Source

const HAS_EXPORT: bool

export type declarations.

Source

const HAS_GOTO: bool

goto and ::label:: statements.

Source

const HAS_BITWISE_OPS: bool

Bitwise operators (&, |, ~, <<, >>).

Source

const HAS_VARIABLE_ATTRIBUTES: bool

<const> and <close> variable attributes (Lua 5.4).

Source

const HAS_CONST: bool

local const x = 5 immutable bindings (Luau).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl LuaVersion for Lua51

Source§

const NAME: &'static str = "Lua 5.1"

Source§

const HAS_FLOOR_DIV: bool = false

Source§

const HAS_COMPOUND_ASSIGN: bool = false

Source§

const HAS_CONTINUE: bool = false

Source§

const HAS_IF_EXPR: bool = false

Source§

const HAS_STRING_INTERP: bool = false

Source§

const HAS_TYPE_ANNOTATIONS: bool = false

Source§

const HAS_ATTRIBUTES: bool = false

Source§

const HAS_GENERICS: bool = false

Source§

const HAS_EXPORT: bool = false

Source§

const HAS_GOTO: bool = false

Source§

const HAS_BITWISE_OPS: bool = false

Source§

const HAS_VARIABLE_ATTRIBUTES: bool = false

Source§

const HAS_CONST: bool = false

Source§

impl LuaVersion for Lua52

Source§

const NAME: &'static str = "Lua 5.2"

Source§

const HAS_FLOOR_DIV: bool = false

Source§

const HAS_COMPOUND_ASSIGN: bool = false

Source§

const HAS_CONTINUE: bool = false

Source§

const HAS_IF_EXPR: bool = false

Source§

const HAS_STRING_INTERP: bool = false

Source§

const HAS_TYPE_ANNOTATIONS: bool = false

Source§

const HAS_ATTRIBUTES: bool = false

Source§

const HAS_GENERICS: bool = false

Source§

const HAS_EXPORT: bool = false

Source§

const HAS_GOTO: bool = true

Source§

const HAS_BITWISE_OPS: bool = false

Source§

const HAS_VARIABLE_ATTRIBUTES: bool = false

Source§

const HAS_CONST: bool = false

Source§

impl LuaVersion for Lua53

Source§

impl LuaVersion for Lua54

Source§

impl LuaVersion for Luau