Skip to main content

luau_vm/
lib.rs

1extern crate self as luau_vm;
2
3#[doc(hidden)]
4pub mod __macro_support {
5    pub use luau_printf::ToArg;
6}
7
8#[macro_export]
9macro_rules! error {
10    ($thread:expr, $format:expr $(,)?) => {
11        $thread.lua_error($format, [])
12    };
13    ($thread:expr, $format:expr, $($arg:expr),+ $(,)?) => {{
14        #[allow(unused_imports)]
15        use $crate::__macro_support::ToArg as _;
16        let mut args = [$($arg.to_arg()),+];
17        $thread.lua_error($format, &mut args)
18    }};
19}
20
21#[macro_export]
22macro_rules! run_error {
23    ($thread:expr, $format:expr $(,)?) => {
24        $thread.run_error($format, [])
25    };
26    ($thread:expr, $format:expr, $($arg:expr),+ $(,)?) => {{
27        #[allow(unused_imports)]
28        use $crate::__macro_support::ToArg as _;
29        let mut args = [$($arg.to_arg()),+];
30        $thread.run_error($format, &mut args)
31    }};
32}
33
34#[macro_export]
35macro_rules! push_fstring {
36    ($thread:expr, $format:expr $(,)?) => {
37        $thread.push_fstring($format, [])
38    };
39    ($thread:expr, $format:expr, $($arg:expr),+ $(,)?) => {{
40        #[allow(unused_imports)]
41        use $crate::__macro_support::ToArg as _;
42        let mut args = [$($arg.to_arg()),+];
43        $thread.push_fstring($format, &mut args)
44    }};
45}
46
47mod buffer;
48mod builtins;
49mod call;
50mod class;
51pub mod debug;
52mod error;
53mod function;
54mod gc;
55mod handle;
56pub mod internal;
57mod layout;
58#[allow(
59    clippy::missing_safety_doc,
60    reason = "standard-library installers use Thread's documented shared unsafe contract"
61)]
62mod libs;
63mod load;
64pub mod lua;
65mod memory;
66mod metamethod;
67pub mod native;
68mod number;
69mod perf;
70pub mod state;
71pub mod string;
72mod table;
73pub mod thread;
74pub mod types;
75mod userdata;
76mod value;
77mod vm;
78
79pub(crate) use crate::class::{Class, Object, ObjectMemberLookup};
80pub use crate::debug::{LuaDebug, LuaDebugInterruptHook, LuaHook};
81pub use crate::error::{VmControl, VmError, VmErrorResult, VmExit, VmResult};
82pub use crate::gc::{
83    LUA_GC_COLLECT, LUA_GC_COUNT, LUA_GC_COUNT_B, LUA_GC_IS_PAUSED, LUA_GC_IS_RUNNING,
84    LUA_GC_RESTART, LUA_GC_SET_GOAL, LUA_GC_SET_STEP_MUL, LUA_GC_SET_STEP_SIZE, LUA_GC_STEP,
85    LUA_GC_STOP,
86};
87pub use crate::native::{
88    LuaUserdataRef, LuaUserdataRefMut, NativeArgument, NativeArguments, NativeCallContext,
89    NativeCallResult, NativeFunction, NativeModule, RawNativeContinuation, RawNativeFunction,
90};
91pub use crate::perf::clock;
92pub use crate::string::LuaString;
93pub(crate) use crate::table::Table;
94pub use crate::thread::{LuaStringBuilder, LuaStringBuilderStorage, Thread};
95pub use crate::userdata::{
96    LuaDestructor, LuaInlineDestructor, LuaUserdataDirectAccess, LuaUserdataDirectFieldGet,
97    LuaUserdataDirectNamecall, LuaUserdataMark, USERDATA_TAG_LIMIT, UserdataDirectFieldResult,
98};