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};
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 { self.0 }
52 #[inline(always)]
53 pub fn as_usize(self) -> usize { self.0 as usize }
54}
55
56impl std::ops::Add<i32> for StackIdx {
57 type Output = Self;
58 #[inline(always)]
59 fn add(self, rhs: i32) -> Self { StackIdx((self.0 as i32 + rhs) as u32) }
60}
61impl std::ops::Sub<i32> for StackIdx {
62 type Output = Self;
63 #[inline(always)]
64 fn sub(self, rhs: i32) -> Self { StackIdx((self.0 as i32 - rhs) as u32) }
65}
66impl std::ops::Sub<StackIdx> for StackIdx {
67 type Output = i32;
68 #[inline(always)]
69 fn sub(self, rhs: StackIdx) -> i32 { self.0 as i32 - rhs.0 as i32 }
70}
71
72#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
74pub struct CallInfoIdx(pub u32);
75
76impl CallInfoIdx {
77 pub const ZERO: Self = CallInfoIdx(0);
78 #[inline(always)]
79 pub fn get(self) -> u32 { self.0 }
80 #[inline(always)]
81 pub fn as_usize(self) -> usize { self.0 as usize }
82}
83
84#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
86#[repr(i8)]
87pub enum LuaType {
88 None = -1,
89 Nil = 0,
90 Boolean = 1,
91 LightUserData = 2,
92 Number = 3,
93 String = 4,
94 Table = 5,
95 Function = 6,
96 UserData = 7,
97 Thread = 8,
98}
99
100impl LuaType {
101 pub const NUM_TYPES: usize = 9;
102}
103
104