Mercurial Hosting > luan
comparison core/src/luan/LuanTable.java @ 647:8e8c30b72e9b
move methods from LuanState to Luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2016 20:39:14 -0600 |
parents | cdc70de628b5 |
children | d3e5414bdf4c |
comparison
equal
deleted
inserted
replaced
646:cdc70de628b5 | 647:8e8c30b72e9b |
---|---|
93 return rawToString(); | 93 return rawToString(); |
94 if( h instanceof LuanMeta ) { | 94 if( h instanceof LuanMeta ) { |
95 LuanMeta meta = (LuanMeta)h; | 95 LuanMeta meta = (LuanMeta)h; |
96 return meta.__to_string(luan,this); | 96 return meta.__to_string(luan,this); |
97 } | 97 } |
98 LuanFunction fn = luan.checkFunction(h); | 98 LuanFunction fn = Luan.checkFunction(h); |
99 return luan.checkString( Luan.first( fn.call(luan,new Object[]{this}) ) ); | 99 return Luan.checkString( Luan.first( fn.call(luan,new Object[]{this}) ) ); |
100 } | 100 } |
101 | 101 |
102 public String rawToString() { | 102 public String rawToString() { |
103 return "table: " + Integer.toHexString(hashCode()); | 103 return "table: " + Integer.toHexString(hashCode()); |
104 } | 104 } |
245 } | 245 } |
246 | 246 |
247 public int length(LuanState luan) throws LuanException { | 247 public int length(LuanState luan) throws LuanException { |
248 Object h = getHandler("__len"); | 248 Object h = getHandler("__len"); |
249 if( h != null ) { | 249 if( h != null ) { |
250 LuanFunction fn = luan.checkFunction(h); | 250 LuanFunction fn = Luan.checkFunction(h); |
251 return (Integer)Luan.first(fn.call(luan,new Object[]{this})); | 251 return (Integer)Luan.first(fn.call(luan,new Object[]{this})); |
252 } | 252 } |
253 return rawLength(); | 253 return rawLength(); |
254 } | 254 } |
255 | 255 |