comparison 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
comparison
equal deleted inserted replaced
571:cd944b010f25 572:f1601a4ce1aa
123 return Luan.first(call(fn,op,new Object[]{o1,o2})); 123 return Luan.first(call(fn,op,new Object[]{o1,o2}));
124 String type = !(o1 instanceof Number) ? Luan.type(o1) : Luan.type(o2); 124 String type = !(o1 instanceof Number) ? Luan.type(o1) : Luan.type(o2);
125 throw exception("attempt to perform arithmetic on a "+type+" value"); 125 throw exception("attempt to perform arithmetic on a "+type+" value");
126 } 126 }
127 127
128 public String toString(Object obj) throws LuanException {
129 if( obj instanceof LuanTable ) {
130 LuanTable tbl = (LuanTable)obj;
131 return tbl.toString(this);
132 }
133 if( obj == null )
134 return "nil";
135 if( obj instanceof Number )
136 return Luan.toString((Number)obj);
137 if( obj instanceof byte[] )
138 return "binary: " + Integer.toHexString(obj.hashCode());
139 return obj.toString();
140 }
141
128 } 142 }