Mercurial Hosting > luan
diff core/src/luan/modules/IoLuan.java @ 221:ec016471c6eb
make LuanTable an interface
git-svn-id: https://luan-java.googlecode.com/svn/trunk@222 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 17 Jul 2014 07:49:26 +0000 |
parents | 61afe2a1ce96 |
children | 97d175772fed |
line wrap: on
line diff
--- a/core/src/luan/modules/IoLuan.java Wed Jul 16 04:59:45 2014 +0000 +++ b/core/src/luan/modules/IoLuan.java Thu Jul 17 07:49:26 2014 +0000 @@ -24,6 +24,7 @@ import java.net.MalformedURLException; import java.util.List; import java.util.ArrayList; +import luan.Luan; import luan.LuanState; import luan.LuanTable; import luan.LuanFunction; @@ -35,12 +36,12 @@ public static final LuanFunction LOADER = new LuanFunction() { @Override public Object call(LuanState luan,Object[] args) { - LuanTable module = new LuanTable(); + LuanTable module = Luan.newTable(); try { add( module, "File", LuanState.class, String.class ); add( module, "read_console_line", String.class ); - LuanTable stdin = new LuanTable(); + LuanTable stdin = Luan.newTable(); stdin.put( "read_text", new LuanJavaFunction( IoLuan.class.getMethod( "stdin_read_text" ), null ) ); @@ -133,7 +134,7 @@ } private static LuanTable writer(LuanWriter luanWriter) { - LuanTable writer = new LuanTable(); + LuanTable writer = Luan.newTable(); try { writer.put( "write", new LuanJavaFunction( LuanWriter.class.getMethod( "write", LuanState.class, new Object[0].getClass() ), luanWriter @@ -149,7 +150,7 @@ public static LuanTable binaryWriter(final OutputStream out) { - LuanTable writer = new LuanTable(); + LuanTable writer = Luan.newTable(); try { writer.put( "write", new LuanJavaFunction( OutputStream.class.getMethod( "write", new byte[0].getClass() ), out @@ -238,7 +239,7 @@ } LuanTable table() { - LuanTable tbl = new LuanTable(); + LuanTable tbl = Luan.newTable(); try { tbl.put( "to_string", new LuanJavaFunction( LuanIn.class.getMethod( "to_string" ), this @@ -358,7 +359,7 @@ File[] files = file.listFiles(); if( files==null ) return null; - LuanTable list = new LuanTable(); + LuanTable list = Luan.newTable(); for( File f : files ) { list.add(new LuanFile(luan,f).table()); }