pub fn load<T: Read>(&mut self, mut reader: BufReader<T>, name: &str) -> Result<()> {
        let mut magic: u8 = 0;
        {
            let buf = reader.fill_buf()?;
            if buf.len() > 0 {
                magic = buf[0]
            }
        }
        let _chunk = if magic == 033 {
            undump::undump(reader)?
        } else {
            let mut parser = parser::Parser::new(reader, name.to_string());
            let stmts = parser.parse()?;
            compiler::compile(stmts, name.to_string())?
        };

        // TODO: save chunk

        Ok(())
    }
/// Load lua chunk from reader
/// Signature `\033Lua` indicates precompiled lua bytecode
Load lua chunk from reader
Signature `\033Lua` indicates precompiled lua bytecode
Load lua chunk from reader Signature ` \ 033Lua ` indicates precompiled lua bytecode
pub fn load<T: Read>(&mut self, mut reader: BufReader<T>, name: &str) -> Result<()> {
        let mut magic: u8 = 0;
        {
            let buf = reader.fill_buf()?;
            if buf.len() > 0 {
                magic = buf[0]
            }
        }
        let _chunk = if magic == 033 {
            undump::undump(reader)?
        } else {
            let mut parser = parser::Parser::new(reader, name.to_string());
            let stmts = parser.parse()?;
            compiler::compile(stmts, name.to_string())?
        };
        // TODO: save chunk
        Ok(())
    }
pub fn load < T : Read > ( & mut self , mut reader : BufReader < T > , name : & str ) -> Result < ( ) > { let mut magic : u8 = 0 ; { let buf = reader . fill_buf ( ) ? ; if buf . len ( ) > 0 { magic = buf [ 0 ] } } let _chunk = if magic == 033 { undump :: undump ( reader ) ? } else { let mut parser = parser :: Parser :: new ( reader , name . to_string ( ) ) ; let stmts = parser . parse ( ) ? ; compiler :: compile ( stmts , name . to_string ( ) ) ? } ; // TODO: save chunk Ok ( ( ) ) }
Load lua chunk from reader
Signature `\033Lua` indicates precompiled lua bytecode
Load lua chunk from reader Signature ` \ 033Lua ` indicates precompiled lua bytecode
&mut self
reader
BufReader<T>
name
&str