String traceback(int level){
  StringBuffer sb=new StringBuffer();
  sb.append("stack traceback:");
  for (DebugLib.CallFrame c; (c=getCallFrame(level++)) != null; ) {
    sb.append("\n\t");
    sb.append(c.shortsource());
    sb.append(':');
    if (c.currentline() > 0)     sb.append(c.currentline() + ":");
    sb.append(" in ");
    DebugInfo ar=auxgetinfo("n",c.f,c);
    if (c.linedefined() == 0)     sb.append("main chunk");
 else     if (ar.name != null) {
      sb.append("function '");
      sb.append(ar.name);
      sb.append('\'');
    }
 else {
      sb.append("function <" + c.shortsource() + ":"+ c.linedefined()+ ">");
    }
  }
  sb.append("\n\t[Java]: in ?");
  return sb.toString();
}

String traceback ( int level ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( "stack traceback:" ) ; for ( DebugLib . CallFrame c ; ( c = getCallFrame ( level ++ ) ) != null ; ) { sb . append ( "\n\t" ) ; sb . append ( c . shortsource ( ) ) ; sb . append ( ':' ) ; if ( c . currentline ( ) > 0 ) sb . append ( c . currentline ( ) + ":" ) ; sb . append ( " in " ) ; DebugInfo ar = auxgetinfo ( "n" , c . f , c ) ; if ( c . linedefined ( ) == 0 ) sb . append ( "main chunk" ) ; else if ( ar . name != null ) { sb . append ( "function '" ) ; sb . append ( ar . name ) ; sb . append ( '\'' ) ; } else { sb . append ( "function <" + c . shortsource ( ) + ":" + c . linedefined ( ) + ">" ) ; } } sb . append ( "\n\t[Java]: in ?" ) ; return sb . toString ( ) ; }
get the traceback starting at a specific level .
