static LuaValue dump(LuaValue arg){
  LuaValue f=arg.checkfunction();
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  try {
    DumpState.dump(((LuaClosure)f).p,baos,true);
    return LuaString.valueOf(baos.toByteArray());
  }
 catch (  IOException e) {
    return error(e.getMessage());
  }
}

static LuaValue dump ( LuaValue arg ) { LuaValue f = arg . checkfunction ( ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { DumpState . dump ( ( ( LuaClosure ) f ) . p , baos , true ) ; return LuaString . valueOf ( baos . toByteArray ( ) ) ; } catch ( IOException e ) { return error ( e . getMessage ( ) ) ; } }
string . dump ( function ) returns a string containing a binary representation of the given function , so that a later loadstring on this string returns a copy of the function . function must be a lua function without upvalues . todo : port dumping code as optional add - on
