Macro dmsdk::lua::error

source ·
macro_rules! error {
    ($l:ident, $($arg:tt)*) => { ... };
}
Expand description

Raises an error with the given message.

The file name and line number will be added to the message, if available. This macro stops execution of the current function (returns !).

Examples

use dmsdk::*;

fn my_lua_fn(l: lua::State) -> i32 {
    let number = 5;
    if number < 11 {
        lua::error!(l, "Expected a number greater than 10, got {number}")
    }

    dmlog::warning!("This line shouldn't get printed!");

    0
}