Skip to main content

lua_types/
opcode.rs

1//! `Instruction` — a single packed bytecode word. C-Lua uses `u32`.
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
4#[repr(transparent)]
5pub struct Instruction(pub u32);
6
7impl Instruction {
8    pub const fn new(raw: u32) -> Self { Instruction(raw) }
9    pub const fn raw(self) -> u32 { self.0 }
10}
11
12// ──────────────────────────────────────────────────────────────────────────────
13// PORT STATUS
14//   source:        src/lopcodes.h, src/lopcodes.c
15//   target_crate:  lua-types
16//   confidence:    high
17//   todos:         0
18//   port_notes:    0
19//   unsafe_blocks: 0
20//   notes:         OpCode enum + Instruction word layout. Mirrors C's opcode numbering and
21//                  the iABC/iABx/iAsBx/iAx/isJ encoding macros.
22// ──────────────────────────────────────────────────────────────────────────────