Skip to main content

luaur_common/functions/
assert_handler.rs

1use crate::type_aliases::assert_handler::AssertHandler;
2
3pub fn assert_handler() -> &'static mut AssertHandler {
4    static mut HANDLER: AssertHandler = None;
5
6    // Safety: In the original C++, this is a function-local static.
7    // While C++11 guarantees thread-safe initialization for statics,
8    // it does not guarantee thread-safe access to the object itself.
9    // Luau's Common.h usage of this global handler is typically
10    // configured once at startup or in a single-threaded test context.
11    unsafe { &mut HANDLER }
12}