Add guards on debug output.

This commit is contained in:
James Roseborough
2010-08-25 23:57:38 +00:00
parent d32ef20360
commit 77777a9dd8
2 changed files with 8 additions and 4 deletions

View File

@@ -365,9 +365,13 @@ public class Print extends Lua {
break;
case LuaValue.TUSERDATA:
Object o = v.touserdata();
if ( o != null ) {
String n = o.getClass().getName();
n = n.substring(n.lastIndexOf('.')+1);
ps.print( n+": "+Integer.toHexString(o.hashCode()) );
} else {
ps.print( v.toString() );
}
break;
default:
ps.print(v.tojstring());

View File

@@ -352,7 +352,7 @@ public class DebugLib extends VarArgFunction {
return;
DebugInfo di = ds.getDebugInfo();
if(TRACE)Print.printState(di.closure, pc, di.stack, top, di.varargs);
ds.getDebugInfo().bytecode( pc, extras, top );
di.bytecode( pc, extras, top );
if ( ds.hookcount > 0 ) {
if ( ++ds.hookcodes >= ds.hookcount ) {
ds.hookcodes = 0;