pub fn new_with(libs: StdLib, options: LuaOptions) -> Result<Lua> {
        #[cfg(not(feature = "luau"))]
        if libs.contains(StdLib::DEBUG) {
            return Err(Error::SafetyError(
                "the unsafe `debug` module can't be loaded using safe `new_with`".to_string(),
            ));
        }
        #[cfg(feature = "luajit")]
        {
            if libs.contains(StdLib::FFI) {
                return Err(Error::SafetyError(
                    "the unsafe `ffi` module can't be loaded using safe `new_with`".to_string(),
                ));
            }
        }

        let mut lua = unsafe { Self::inner_new(libs, options) };

        #[cfg(not(feature = "luau"))]
        if libs.contains(StdLib::PACKAGE) {
            mlua_expect!(lua.disable_c_modules(), "Error during disabling C modules");
        }
        lua.safe = true;

        Ok(lua)
    }
/// Creates a new Lua state and loads the specified safe subset of the standard libraries.
///
/// Use the [`StdLib`] flags to specify the libraries you want to load.
///
/// # Safety
/// The created Lua state would have _some_ safety guarantees and would not allow to load unsafe
/// standard libraries or C modules.
///
/// See [`StdLib`] documentation for a list of unsafe modules that cannot be loaded.
///
/// [`StdLib`]: crate::StdLib
Creates a new Lua state and loads the specified safe subset of the standard libraries.
Use the [`StdLib`] flags to specify the libraries you want to load.
Creates a new Lua state and loads the specified safe subset of the standard libraries . Use the [ ` StdLib ` ] flags to specify the libraries you want to load .
pub fn new_with(libs: StdLib, options: LuaOptions) -> Result<Lua> {
        #[cfg(not(feature = "luau"))]
        if libs.contains(StdLib::DEBUG) {
            return Err(Error::SafetyError(
                "the unsafe `debug` module can't be loaded using safe `new_with`".to_string(),
            ));
        }
        #[cfg(feature = "luajit")]
        {
            if libs.contains(StdLib::FFI) {
                return Err(Error::SafetyError(
                    "the unsafe `ffi` module can't be loaded using safe `new_with`".to_string(),
                ));
            }
        }
        let mut lua = unsafe { Self::inner_new(libs, options) };
        #[cfg(not(feature = "luau"))]
        if libs.contains(StdLib::PACKAGE) {
            mlua_expect!(lua.disable_c_modules(), "Error during disabling C modules");
        }
        lua.safe = true;
        Ok(lua)
    }
pub fn new_with ( libs : StdLib , options : LuaOptions ) -> Result < Lua > { # [ cfg ( not ( feature " " ) ) ] if libs . contains ( StdLib :: DEBUG ) { return Err ( Error :: SafetyError ( " " . to_string ( ) , ) ) ; } # [ cfg ( feature " " ) ] { if libs . contains ( StdLib :: FFI ) { return Err ( Error :: SafetyError ( " " . to_string ( ) , ) ) ; } } let mut lua = unsafe { Self :: inner_new ( libs , options ) } ; # [ cfg ( not ( feature " " ) ) ] if libs . contains ( StdLib :: PACKAGE ) { mlua_expect ! ( lua disable_c_modules ( ) " " ) ; } lua . safe = true ; Ok ( lua ) }
Creates a new Lua state and loads the specified safe subset of the standard libraries.
Creates a new Lua state and loads the specified safe subset of the standard libraries .
libs
StdLib
options
LuaOptions
libs
StdLib
options
LuaOptions
safety
The created Lua state would have _some_ safety guarantees and would not allow to load unsafe
standard libraries or C modules.

See [`StdLib`] documentation for a list of unsafe modules that cannot be loaded.

[`StdLib`]: crate::StdLib
The created Lua state would have _some_ safety guarantees and would not allow to load unsafe standard libraries or C modules . See [ ` StdLib ` ] documentation for a list of unsafe modules that cannot be loaded . [ ` StdLib ` ] : crate :: StdLib