Mercurial Hosting > luan
diff src/luan/LuanBit.java @ 112:f5af13062b10
fix previous rev
git-svn-id: https://luan-java.googlecode.com/svn/trunk@113 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 23 May 2014 22:52:39 +0000 |
parents | 2428ecfed375 |
children | d7be9b3abf1a |
line wrap: on
line diff
--- a/src/luan/LuanBit.java Fri May 23 20:40:05 2014 +0000 +++ b/src/luan/LuanBit.java Fri May 23 22:52:39 2014 +0000 @@ -16,7 +16,11 @@ return new LuanException(this,msg); } - public Object call(LuanFunction fn,String fnName,Object... args) throws LuanException { + public Object call(LuanFunction fn,String fnName) throws LuanException { + return call(fn,fnName,LuanFunction.EMPTY); + } + + public Object call(LuanFunction fn,String fnName,Object[] args) throws LuanException { List<StackTraceElement> stackTrace = luan.stackTrace; stackTrace.add( new StackTraceElement(el,fnName) ); try { @@ -49,14 +53,14 @@ public String toString(Object obj) throws LuanException { LuanFunction fn = getHandlerFunction("__tostring",obj); if( fn != null ) - return checkString( Luan.first( call(fn,"__tostring",obj) ) ); + return checkString( Luan.first( call(fn,"__tostring",new Object[]{obj}) ) ); return Luan.toString(obj); } public String repr(Object obj) throws LuanException { LuanFunction fn = getHandlerFunction("__repr",obj); if( fn != null ) - return checkString( Luan.first( call(fn,"__repr",obj) ) ); + return checkString( Luan.first( call(fn,"__repr",new Object[]{obj}) ) ); String repr = Luan.repr(obj); if( repr==null ) throw exception( "value '" + obj + "' doesn't support repr()" ); @@ -90,14 +94,14 @@ } LuanFunction fn = getBinHandler("__lt",o1,o2); if( fn != null ) - return Luan.toBoolean( Luan.first(call(fn,"__lt",o1,o2)) ); + return Luan.toBoolean( Luan.first(call(fn,"__lt",new Object[]{o1,o2})) ); throw exception( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); } public Object arithmetic(String op,Object o1,Object o2) throws LuanException { LuanFunction fn = getBinHandler(op,o1,o2); if( fn != null ) - return Luan.first(call(fn,op,o1,o2)); + return Luan.first(call(fn,op,new Object[]{o1,o2})); String type = Luan.toNumber(o1)==null ? Luan.type(o1) : Luan.type(o2); throw exception("attempt to perform arithmetic on a "+type+" value"); }