1pub mod arith;
11pub mod closure;
12pub mod error;
13pub mod filehandle;
14pub mod gc;
15pub mod opcode;
16pub mod proto;
17pub mod status;
18pub mod string;
19pub mod table;
20pub mod tagmethod;
21pub mod trace_impls;
22pub mod upval;
23pub mod userdata;
24pub mod value;
25pub mod version;
26
27pub use closure::{LuaClosure, LuaLClosure};
29pub use error::{LuaError, LuaExit, LuaThreadClose};
30pub use filehandle::LuaFileHandle;
31pub use gc::GcRef;
32pub use proto::{AbsLineInfo, LocalVar, LuaProto, UpvalDesc};
33pub use status::LuaStatus;
34pub use string::LuaString;
35pub use table::LuaTable;
36pub use upval::{UpVal, UpValState};
37pub use userdata::LuaUserData;
38pub use value::{F2Imod, LuaValue};
39pub use version::{LuaVersion, NumberModel};
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
46pub struct StackIdx(pub u32);
47
48impl StackIdx {
49 pub const ZERO: Self = StackIdx(0);
50 #[inline(always)]
51 pub fn get(self) -> u32 {
52 self.0
53 }
54 #[inline(always)]
55 pub fn as_usize(self) -> usize {
56 self.0 as usize
57 }
58}
59
60impl std::ops::Add<i32> for StackIdx {
61 type Output = Self;
62 #[inline(always)]
63 fn add(self, rhs: i32) -> Self {
64 StackIdx((self.0 as i32 + rhs) as u32)
65 }
66}
67impl std::ops::Sub<i32> for StackIdx {
68 type Output = Self;
69 #[inline(always)]
70 fn sub(self, rhs: i32) -> Self {
71 StackIdx((self.0 as i32 - rhs) as u32)
72 }
73}
74impl std::ops::Sub<StackIdx> for StackIdx {
75 type Output = i32;
76 #[inline(always)]
77 fn sub(self, rhs: StackIdx) -> i32 {
78 self.0 as i32 - rhs.0 as i32
79 }
80}
81
82#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
84pub struct CallInfoIdx(pub u32);
85
86impl CallInfoIdx {
87 pub const ZERO: Self = CallInfoIdx(0);
88 #[inline(always)]
89 pub fn get(self) -> u32 {
90 self.0
91 }
92 #[inline(always)]
93 pub fn as_usize(self) -> usize {
94 self.0 as usize
95 }
96}
97
98#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
100#[repr(i8)]
101pub enum LuaType {
102 None = -1,
103 Nil = 0,
104 Boolean = 1,
105 LightUserData = 2,
106 Number = 3,
107 String = 4,
108 Table = 5,
109 Function = 6,
110 UserData = 7,
111 Thread = 8,
112}
113
114impl LuaType {
115 pub const NUM_TYPES: usize = 9;
116}
117
118