Mercurial Hosting > luan
comparison src/luan/modules/TableLuan.java @ 1277:5ba660381bd5
fix Io.print()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 11 Dec 2018 03:38:43 -0700 |
parents | 9fa8b8389578 |
children | f41919741100 |
comparison
equal
deleted
inserted
replaced
1276:623dfe0e2e73 | 1277:5ba660381bd5 |
---|---|
90 return tbl; | 90 return tbl; |
91 } | 91 } |
92 | 92 |
93 @LuanMethod public static Object[] unpack(LuanTable tbl,Integer iFrom,Integer iTo) throws LuanException { | 93 @LuanMethod public static Object[] unpack(LuanTable tbl,Integer iFrom,Integer iTo) throws LuanException { |
94 int from = iFrom!=null ? iFrom : 1; | 94 int from = iFrom!=null ? iFrom : 1; |
95 int to = iTo!=null ? iTo : tbl.length(); | 95 int to; |
96 if( iTo != null ) { | |
97 to = iTo; | |
98 } else { | |
99 Integer n = Luan.asInteger( tbl.get("n") ); | |
100 to = n!=null ? n : tbl.length(); | |
101 } | |
96 List<Object> list = new ArrayList<Object>(); | 102 List<Object> list = new ArrayList<Object>(); |
97 for( int i=from; i<=to; i++ ) { | 103 for( int i=from; i<=to; i++ ) { |
98 list.add( tbl.get(i) ); | 104 list.add( tbl.get(i) ); |
99 } | 105 } |
100 return list.toArray(); | 106 return list.toArray(); |