Mercurial Hosting > luan
comparison core/src/luan/modules/IoLuan.java @ 296:7ea6dfdf81ba
add env param to load_file()
git-svn-id: https://luan-java.googlecode.com/svn/trunk@297 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 15 Dec 2014 08:03:32 +0000 |
parents | a50e88d3547c |
children | 899253043270 |
comparison
equal
deleted
inserted
replaced
295:1f4cc8505308 | 296:7ea6dfdf81ba |
---|---|
205 public LuanFunction read_blocks(Integer blockSize) throws IOException { | 205 public LuanFunction read_blocks(Integer blockSize) throws IOException { |
206 int n = blockSize!=null ? blockSize : Utils.bufSize; | 206 int n = blockSize!=null ? blockSize : Utils.bufSize; |
207 return blocks(inputStream(),n); | 207 return blocks(inputStream(),n); |
208 } | 208 } |
209 | 209 |
210 public LuanFunction loader(LuanState luan,String name) throws LuanException { | 210 public LuanFunction loader(LuanState luan,String name,LuanTable env) throws LuanException { |
211 try { | 211 try { |
212 String src = read_text(); | 212 String src = read_text(); |
213 return BasicLuan.load(luan,src,name,null,false); | 213 return BasicLuan.load(luan,src,name,env,false); |
214 } catch(FileNotFoundException e) { | 214 } catch(FileNotFoundException e) { |
215 return null; | 215 return null; |
216 } catch(IOException e) { | 216 } catch(IOException e) { |
217 throw luan.exception(e); | 217 throw luan.exception(e); |
218 } | 218 } |
244 ) ); | 244 ) ); |
245 tbl.put( "read_blocks", new LuanJavaFunction( | 245 tbl.put( "read_blocks", new LuanJavaFunction( |
246 LuanIn.class.getMethod( "read_blocks", Integer.class ), this | 246 LuanIn.class.getMethod( "read_blocks", Integer.class ), this |
247 ) ); | 247 ) ); |
248 tbl.put( "loader", new LuanJavaFunction( | 248 tbl.put( "loader", new LuanJavaFunction( |
249 LuanIn.class.getMethod( "loader", LuanState.class, String.class ), this | 249 LuanIn.class.getMethod( "loader", LuanState.class, String.class, LuanTable.class ), this |
250 ) ); | 250 ) ); |
251 tbl.put( "exists", new LuanJavaFunction( | 251 tbl.put( "exists", new LuanJavaFunction( |
252 LuanIn.class.getMethod( "exists" ), this | 252 LuanIn.class.getMethod( "exists" ), this |
253 ) ); | 253 ) ); |
254 } catch(NoSuchMethodException e) { | 254 } catch(NoSuchMethodException e) { |