Skip to main content

luaur_bytecode_cli/functions/
assertion_handler.rs

1use core::ffi::c_char;
2use core::ffi::CStr;
3
4#[allow(non_snake_case)]
5pub fn assertion_handler(
6    expr: *const c_char,
7    file: *const c_char,
8    line: i32,
9    _function: *const c_char,
10) -> i32 {
11    unsafe {
12        let file_str = CStr::from_ptr(file).to_string_lossy();
13        let expr_str = CStr::from_ptr(expr).to_string_lossy();
14
15        println!("{}({}): ASSERTION FAILED: {}", file_str, line, expr_str);
16    }
17    1
18}