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;
25
26pub use closure::{LuaClosure, LuaLClosure};
28pub use error::LuaError;
29pub use filehandle::LuaFileHandle;
30pub use gc::GcRef;
31pub use proto::{AbsLineInfo, LocalVar, LuaProto, UpvalDesc};
32pub use status::LuaStatus;
33pub use string::LuaString;
34pub use table::LuaTable;
35pub use upval::{UpVal, UpValState};
36pub use userdata::LuaUserData;
37pub use value::{F2Imod, LuaValue};
38
39#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
44pub struct StackIdx(pub u32);
45
46impl StackIdx {
47 pub const ZERO: Self = StackIdx(0);
48 #[inline(always)]
49 pub fn get(self) -> u32 { self.0 }
50 #[inline(always)]
51 pub fn as_usize(self) -> usize { self.0 as usize }
52}
53
54impl std::ops::Add<i32> for StackIdx {
55 type Output = Self;
56 #[inline(always)]
57 fn add(self, rhs: i32) -> Self { StackIdx((self.0 as i32 + rhs) as u32) }
58}
59impl std::ops::Sub<i32> for StackIdx {
60 type Output = Self;
61 #[inline(always)]
62 fn sub(self, rhs: i32) -> Self { StackIdx((self.0 as i32 - rhs) as u32) }
63}
64impl std::ops::Sub<StackIdx> for StackIdx {
65 type Output = i32;
66 #[inline(always)]
67 fn sub(self, rhs: StackIdx) -> i32 { self.0 as i32 - rhs.0 as i32 }
68}
69
70#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
72pub struct CallInfoIdx(pub u32);
73
74impl CallInfoIdx {
75 pub const ZERO: Self = CallInfoIdx(0);
76 #[inline(always)]
77 pub fn get(self) -> u32 { self.0 }
78 #[inline(always)]
79 pub fn as_usize(self) -> usize { self.0 as usize }
80}
81
82#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
84#[repr(i8)]
85pub enum LuaType {
86 None = -1,
87 Nil = 0,
88 Boolean = 1,
89 LightUserData = 2,
90 Number = 3,
91 String = 4,
92 Table = 5,
93 Function = 6,
94 UserData = 7,
95 Thread = 8,
96}
97
98impl LuaType {
99 pub const NUM_TYPES: usize = 9;
100}
101
102