Mercurial Hosting > luan
diff core/src/luan/LuanBit.java @ 572:f1601a4ce1aa
fix stack when calling meta-methods
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 12 Jul 2015 21:34:23 -0600 |
parents | e3b0846dc2ef |
children | 6cc2f047019b |
line wrap: on
line diff
--- a/core/src/luan/LuanBit.java Wed Jul 08 23:10:52 2015 -0600 +++ b/core/src/luan/LuanBit.java Sun Jul 12 21:34:23 2015 -0600 @@ -125,4 +125,18 @@ throw exception("attempt to perform arithmetic on a "+type+" value"); } + public String toString(Object obj) throws LuanException { + if( obj instanceof LuanTable ) { + LuanTable tbl = (LuanTable)obj; + return tbl.toString(this); + } + if( obj == null ) + return "nil"; + if( obj instanceof Number ) + return Luan.toString((Number)obj); + if( obj instanceof byte[] ) + return "binary: " + Integer.toHexString(obj.hashCode()); + return obj.toString(); + } + }