Mercurial Hosting > luan
comparison core/src/luan/LuanBit.java @ 416:91af5337b9ae
add LuanMeta.__tostring()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 30 Apr 2015 06:28:25 -0600 |
parents | d55e873e1f0d |
children | 8fbb961aabd5 |
comparison
equal
deleted
inserted
replaced
415:ce8e19567911 | 416:91af5337b9ae |
---|---|
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 public String toString(Object obj) throws LuanException { | 90 public String toString(Object obj) throws LuanException { |
91 if( obj instanceof LuanTable ) { | 91 if( obj instanceof LuanTable ) { |
92 LuanFunction fn = getHandlerFunction("__tostring",(LuanTable)obj); | 92 LuanTable tbl = (LuanTable)obj; |
93 Object h = luan.getHandler("__tostring",tbl); | |
94 if( h instanceof LuanMeta ) { | |
95 LuanMeta meta = (LuanMeta)h; | |
96 return meta.__tostring(luan,tbl); | |
97 } | |
98 LuanFunction fn = checkFunction(h); | |
93 if( fn != null ) | 99 if( fn != null ) |
94 return checkString( Luan.first( call(fn,"__tostring",new Object[]{obj}) ) ); | 100 return checkString( Luan.first( call(fn,"__tostring",new Object[]{obj}) ) ); |
95 } | 101 } |
96 return Luan.toString(obj); | 102 return Luan.toString(obj); |
97 } | 103 } |