comparison src/luan/interp/ConcatExpr.java @ 37:8a57ebfdfd78

add JavaLib git-svn-id: https://luan-java.googlecode.com/svn/trunk@38 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 20 Dec 2012 02:36:07 +0000
parents e51906de0f11
children e3624b7cd603
comparison
equal deleted inserted replaced
36:2a35154aec14 37:8a57ebfdfd78
16 Object o2 = op2.eval(lua); 16 Object o2 = op2.eval(lua);
17 String s1 = Lua.asString(o1); 17 String s1 = Lua.asString(o1);
18 String s2 = Lua.asString(o2); 18 String s2 = Lua.asString(o2);
19 if( s1 != null && s2 != null ) 19 if( s1 != null && s2 != null )
20 return s1 + s2; 20 return s1 + s2;
21 LuaFunction fn = getBinHandler("__concat",o1,o2); 21 LuaFunction fn = lua.getBinHandler("__concat",o1,o2);
22 if( fn != null ) 22 if( fn != null )
23 return Utils.first(fn.call(lua,o1,o2)); 23 return Utils.first(fn.call(lua,o1,o2));
24 String type = s1==null ? Lua.type(o1) : Lua.type(o2); 24 String type = s1==null ? Lua.type(o1) : Lua.type(o2);
25 throw new LuaException( "attempt to concatenate a " + type + " value" ); 25 throw new LuaException( "attempt to concatenate a " + type + " value" );
26 } 26 }