Skip to main content

Opcode

Enum Opcode 

Source
#[repr(u8)]
pub enum Opcode {
Show 90 variants Nop = 0, Break = 1, LoadNil = 2, LoadB = 3, LoadN = 4, LoadK = 5, Move = 6, GetGlobal = 7, SetGlobal = 8, GetUpval = 9, SetUpval = 10, CloseUpvals = 11, GetImport = 12, GetTable = 13, SetTable = 14, GetTableKs = 15, SetTableKs = 16, GetTableN = 17, SetTableN = 18, NewClosure = 19, NameCall = 20, Call = 21, Return = 22, Jump = 23, JumpBack = 24, JumpIf = 25, JumpIfNot = 26, JumpIfEq = 27, JumpIfLe = 28, JumpIfLt = 29, JumpIfNotEq = 30, JumpIfNotLe = 31, JumpIfNotLt = 32, Add = 33, Sub = 34, Mul = 35, Div = 36, Mod = 37, Pow = 38, AddK = 39, SubK = 40, MulK = 41, DivK = 42, ModK = 43, PowK = 44, And = 45, Or = 46, AndK = 47, OrK = 48, Concat = 49, Not = 50, Minus = 51, Length = 52, NewTable = 53, DupTable = 54, SetList = 55, ForNPrep = 56, ForNLoop = 57, ForGLoop = 58, ForGPrepInext = 59, FastCall3 = 60, ForGPrepNext = 61, NativeCall = 62, GetVarargs = 63, DupClosure = 64, PrepVarargs = 65, LoadKx = 66, JumpX = 67, FastCall = 68, Coverage = 69, Capture = 70, SubRk = 71, DivRk = 72, FastCall1 = 73, FastCall2 = 74, FastCall2K = 75, ForGPrep = 76, JumpXEqKNil = 77, JumpXEqKB = 78, JumpXEqKN = 79, JumpXEqKS = 80, IDiv = 81, IDivK = 82, GetUdataKs = 83, SetUdataKs = 84, NameCallUdata = 85, NewClassMember = 86, CallFb = 87, CmpProto = 88, NewClass = 89,
}
Expand description

Luau bytecode opcode stored in the low byte of each instruction word.

Variants§

§

Nop = 0

No operation.

§

Break = 1

Debugger break.

§

LoadNil = 2

Load nil.

§

LoadB = 3

Load boolean.

§

LoadN = 4

Load small number.

§

LoadK = 5

Load constant.

§

Move = 6

Move register.

§

GetGlobal = 7

Get global.

§

SetGlobal = 8

Set global.

§

GetUpval = 9

Get upvalue.

§

SetUpval = 10

Set upvalue.

§

CloseUpvals = 11

Close upvalues.

§

GetImport = 12

Get import.

§

GetTable = 13

Get table by register key.

§

SetTable = 14

Set table by register key.

§

GetTableKs = 15

Get table by string key.

§

SetTableKs = 16

Set table by string key.

§

GetTableN = 17

Get table by small integer key.

§

SetTableN = 18

Set table by small integer key.

§

NewClosure = 19

New closure.

§

NameCall = 20

Method-call preparation.

§

Call = 21

Function call.

§

Return = 22

Return from function.

§

Jump = 23

Relative jump.

§

JumpBack = 24

Backedge jump.

§

JumpIf = 25

Conditional truthy jump.

§

JumpIfNot = 26

Conditional falsey jump.

§

JumpIfEq = 27

Equality jump.

§

JumpIfLe = 28

Less-or-equal jump.

§

JumpIfLt = 29

Less-than jump.

§

JumpIfNotEq = 30

Inequality jump.

§

JumpIfNotLe = 31

Not less-or-equal jump.

§

JumpIfNotLt = 32

Not less-than jump.

§

Add = 33

Addition.

§

Sub = 34

Subtraction.

§

Mul = 35

Multiplication.

§

Div = 36

Division.

§

Mod = 37

Modulo.

§

Pow = 38

Power.

§

AddK = 39

Addition with constant.

§

SubK = 40

Subtraction with constant.

§

MulK = 41

Multiplication with constant.

§

DivK = 42

Division with constant.

§

ModK = 43

Modulo with constant.

§

PowK = 44

Power with constant.

§

And = 45

Logical and.

§

Or = 46

Logical or.

§

AndK = 47

Logical and with constant.

§

OrK = 48

Logical or with constant.

§

Concat = 49

Concatenation.

§

Not = 50

Logical not.

§

Minus = 51

Numeric negation.

§

Length = 52

Length.

§

NewTable = 53

Create table.

§

DupTable = 54

Duplicate table template.

§

SetList = 55

Set list.

§

ForNPrep = 56

Numeric-for preparation.

§

ForNLoop = 57

Numeric-for loop.

§

ForGLoop = 58

Generic-for loop.

§

ForGPrepInext = 59

Generic-for preparation for inext.

§

FastCall3 = 60

Fastcall with three register arguments.

§

ForGPrepNext = 61

Generic-for preparation for next.

§

NativeCall = 62

Runtime native call pseudo-instruction.

§

GetVarargs = 63

Get varargs.

§

DupClosure = 64

Duplicate closure.

§

PrepVarargs = 65

Prepare varargs.

§

LoadKx = 66

Load extended constant.

§

JumpX = 67

Long relative jump.

§

FastCall = 68

Fastcall.

§

Coverage = 69

Coverage counter.

§

Capture = 70

Upvalue capture.

§

SubRk = 71

Constant-minus-register subtraction.

§

DivRk = 72

Constant-divided-by-register division.

§

FastCall1 = 73

Fastcall with one register argument.

§

FastCall2 = 74

Fastcall with two register arguments.

§

FastCall2K = 75

Fastcall with one register and one constant argument.

§

ForGPrep = 76

Generic-for preparation.

§

JumpXEqKNil = 77

Nil equality jump.

§

JumpXEqKB = 78

Boolean equality jump.

§

JumpXEqKN = 79

Number equality jump.

§

JumpXEqKS = 80

String equality jump.

§

IDiv = 81

Floor division.

§

IDivK = 82

Floor division with constant.

§

GetUdataKs = 83

Userdata field get.

§

SetUdataKs = 84

Userdata field set.

§

NameCallUdata = 85

Userdata method-call preparation.

§

NewClassMember = 86

Register class member.

§

CallFb = 87

Call with feedback slot.

§

CmpProto = 88

Compare closure proto.

§

NewClass = 89

Reify a class object.

Implementations§

Source§

impl Opcode

Source

pub const COUNT: u8 = 90

Sentinel one past the largest valid opcode.

Source

pub const fn from_byte(value: u8) -> Option<Self>

Converts the serialized opcode byte into a typed opcode.

Source

pub const fn byte(self) -> u8

Serialized numeric value.

Source

pub const fn instruction_len(self) -> usize

Number of 32-bit words occupied by the instruction.

Trait Implementations§

Source§

impl Clone for Opcode

Source§

fn clone(&self) -> Self

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 Opcode

Source§

impl Debug for Opcode

Source§

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

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

impl<'de> Deserialize<'de> for Opcode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Opcode

Source§

impl Hash for Opcode

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 Ord for Opcode

Source§

fn cmp(&self, other: &Self) -> 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§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Opcode

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Opcode

Source§

fn partial_cmp(&self, other: &Self) -> 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 Serialize for Opcode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Opcode

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.