comparison src/luan/LuaState.java @ 42:786699c78837

implement try-catch git-svn-id: https://luan-java.googlecode.com/svn/trunk@43 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Sun, 23 Dec 2012 06:36:56 +0000
parents e3624b7cd603
children 57054fa43189
comparison
equal deleted inserted replaced
41:c53dc854e6cc 42:786699c78837
63 LuaFunction fn = getHandlerFunction(el,"__tostring",obj); 63 LuaFunction fn = getHandlerFunction(el,"__tostring",obj);
64 if( fn != null ) 64 if( fn != null )
65 return checkString( el, Lua.first( call(fn,el,"__tostring",obj) ) ); 65 return checkString( el, Lua.first( call(fn,el,"__tostring",obj) ) );
66 if( obj == null ) 66 if( obj == null )
67 return "nil"; 67 return "nil";
68 if( obj instanceof LuaException ) {
69 LuaException le = (LuaException)obj;
70 return le.getMessage();
71 }
68 return obj.toString(); 72 return obj.toString();
69 } 73 }
70 74
71 public final LuaFunction getHandlerFunction(LuaElement el,String op,Object obj) throws LuaException { 75 public final LuaFunction getHandlerFunction(LuaElement el,String op,Object obj) throws LuaException {
72 Object f = getHandler(op,obj); 76 Object f = getHandler(op,obj);