luaur_common/functions/
assert_call_handler.rs1use crate::functions::assert_handler::assert_handler;
2use crate::macros::luau_noinline::LUAU_NOINLINE;
3use core::ffi::c_char;
4
5LUAU_NOINLINE! {
6 pub fn assert_call_handler(
7 expression: *const c_char,
8 file: *const c_char,
9 line: i32,
10 function: *const c_char,
11 ) -> i32 {
12 let handler_ptr = assert_handler();
13 if let Some(handler) = *handler_ptr {
14 unsafe {
15 return handler(expression, file, line, function);
16 }
17 }
18
19 #[cfg(feature = "std")]
25 unsafe {
26 let expr = core::ffi::CStr::from_ptr(expression).to_string_lossy();
27 let f = core::ffi::CStr::from_ptr(file).to_string_lossy();
28 eprintln!("LUAU_ASSERT failed: {} ({}:{})", expr, f, line);
29 }
30
31 1
32 }
33}