Skip to main content

luaur_vm/functions/
lua_l_optinteger_64.rs

1use crate::functions::lua_l_checkinteger_64::lua_l_checkinteger_64;
2use crate::macros::lua_l_opt::luaL_opt;
3use crate::type_aliases::lua_state::lua_State;
4use core::ffi::c_int;
5
6#[no_mangle]
7pub unsafe fn lua_l_optinteger_64(L: *mut lua_State, narg: c_int, def: i64) -> i64 {
8    // The macro luaL_opt! expands to:
9    // if lua_isnoneornil(L, narg) { def } else { luaL_checkinteger64(L, narg) }
10    // We use the already-translated lua_l_checkinteger_64 as the function argument.
11    luaL_opt!(L, lua_l_checkinteger_64, narg, def)
12}