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

        let res = unsafe { load_from_std_lib(self.main_state, libs) };

        // If `package` library loaded into a safe lua state then disable C modules
        let extra = unsafe { &mut *self.extra.get() };
        #[cfg(not(feature = "luau"))]
        {
            let curr_libs = extra.libs;
            if self.safe && (curr_libs ^ (curr_libs | libs)).contains(StdLib::PACKAGE) {
                mlua_expect!(self.disable_c_modules(), "Error during disabling C modules");
            }
        }
        extra.libs |= libs;

        res
    }
/// Loads the specified subset of the standard libraries into an existing Lua state.
///
/// Use the [`StdLib`] flags to specify the libraries you want to load.
///
/// [`StdLib`]: crate::StdLib
Loads the specified subset of the standard libraries into an existing Lua state.
Use the [`StdLib`] flags to specify the libraries you want to load.


Loads the specified subset of the standard libraries into an existing Lua state . Use the [ ` StdLib ` ] flags to specify the libraries you want to load .
pub fn load_from_std_lib(&self, libs: StdLib) -> Result<()> {
        #[cfg(not(feature = "luau"))]
        if self.safe && libs.contains(StdLib::DEBUG) {
            return Err(Error::SafetyError(
                "the unsafe `debug` module can't be loaded in safe mode".to_string(),
            ));
        }
        #[cfg(feature = "luajit")]
        {
            if self.safe && libs.contains(StdLib::FFI) {
                return Err(Error::SafetyError(
                    "the unsafe `ffi` module can't be loaded in safe mode".to_string(),
                ));
            }
        }
        let res = unsafe { load_from_std_lib(self.main_state, libs) };
        // If `package` library loaded into a safe lua state then disable C modules
        let extra = unsafe { &mut *self.extra.get() };
        #[cfg(not(feature = "luau"))]
        {
            let curr_libs = extra.libs;
            if self.safe && (curr_libs ^ (curr_libs | libs)).contains(StdLib::PACKAGE) {
                mlua_expect!(self.disable_c_modules(), "Error during disabling C modules");
            }
        }
        extra.libs |= libs;
        res
    }
pub fn load_from_std_lib ( & self , libs : StdLib ) -> Result < ( ) > { # [ cfg ( not ( feature " " ) ) ] if self . safe && libs . contains ( StdLib :: DEBUG ) { return Err ( Error :: SafetyError ( " " . to_string ( ) , ) ) ; } # [ cfg ( feature " " ) ] { if self . safe && libs . contains ( StdLib :: FFI ) { return Err ( Error :: SafetyError ( " " . to_string ( ) , ) ) ; } } let res = unsafe { load_from_std_lib ( self . main_state , libs ) } ; // If `package` library loaded into a safe lua state then disable C modules let extra = unsafe { & mut * self . extra . get ( ) } ; # [ cfg ( not ( feature " " ) ) ] { let curr_libs = extra . libs ; if self . safe && ( curr_libs ^ ( curr_libs | libs ) ) . contains ( StdLib :: PACKAGE ) { mlua_expect ! ( self disable_c_modules ( ) " " ) ; } } extra . libs |= libs ; res }
Loads the specified subset of the standard libraries into an existing Lua state.
Loads the specified subset of the standard libraries into an existing Lua state .
&self
libs
StdLib
&self
libs
StdLib