Mercurial Hosting > luan
comparison core/src/luan/LuanMeta.java @ 415:ce8e19567911
make LuanPropertyMeta a singleton
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 30 Apr 2015 06:04:17 -0600 |
parents | 8937263f59f6 |
children | 91af5337b9ae |
comparison
equal
deleted
inserted
replaced
414:d2ab2240cc65 | 415:ce8e19567911 |
---|---|
8 | 8 |
9 public abstract class LuanMeta { | 9 public abstract class LuanMeta { |
10 | 10 |
11 public abstract Object __index(LuanState luan,LuanTable tbl,Object key) throws LuanException; | 11 public abstract Object __index(LuanState luan,LuanTable tbl,Object key) throws LuanException; |
12 | 12 |
13 protected abstract Iterator keys(); | 13 protected abstract Iterator keys(LuanTable tbl); |
14 | 14 |
15 public LuanFunction __pairs(final LuanState luan,final LuanTable tbl) { | 15 public LuanFunction __pairs(final LuanState luan,final LuanTable tbl) { |
16 return new LuanFunction() { | 16 return new LuanFunction() { |
17 final Iterator<Map.Entry<Object,Object>> iter1 = tbl.iterator(); | 17 final Iterator<Map.Entry<Object,Object>> iter1 = tbl.iterator(); |
18 final Iterator<Object> iter2 = keys(); | 18 final Iterator<Object> iter2 = keys(tbl); |
19 final Set<Object> set = new HashSet<Object>(); | 19 final Set<Object> set = new HashSet<Object>(); |
20 | 20 |
21 @Override public Object[] call(LuanState luan,Object[] args) throws LuanException { | 21 @Override public Object[] call(LuanState luan,Object[] args) throws LuanException { |
22 if( iter1.hasNext() ) { | 22 if( iter1.hasNext() ) { |
23 Map.Entry<Object,Object> entry = iter1.next(); | 23 Map.Entry<Object,Object> entry = iter1.next(); |