luaur_vm/functions/
lua_b_error.rs1use crate::functions::lua_concat::lua_concat;
5use crate::functions::lua_error::lua_error;
6use crate::functions::lua_isstring::lua_isstring;
7use crate::functions::lua_l_optinteger::lua_l_optinteger;
8use crate::functions::lua_l_where::lua_l_where;
9use crate::functions::lua_pushvalue::lua_pushvalue;
10use crate::functions::lua_settop::lua_settop;
11use crate::type_aliases::lua_state::lua_State;
12
13#[allow(non_snake_case)]
14pub unsafe fn lua_b_error(L: *mut lua_State) -> i32 {
15 let level = lua_l_optinteger(L, 2, 1);
16 lua_settop(L, 1);
17 if lua_isstring(L, 1) != 0 && level > 0 {
18 lua_l_where(L, level);
19 lua_pushvalue(L, 1);
20 lua_concat(L, 2);
21 }
22 lua_error(L);
23}