Mercurial Hosting > luan
comparison core/src/luan/modules/BasicLuan.java @ 299:a74559240b4f
simplify PackageLuan and remove IO loading param
git-svn-id: https://luan-java.googlecode.com/svn/trunk@300 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 16 Dec 2014 06:24:49 +0000 |
parents | 899253043270 |
children | db37d6aee4db |
comparison
equal
deleted
inserted
replaced
298:2ce23c7e2342 | 299:a74559240b4f |
---|---|
33 } | 33 } |
34 | 34 |
35 public static LuanFunction load_file(LuanState luan,String fileName,LuanTable env) throws LuanException { | 35 public static LuanFunction load_file(LuanState luan,String fileName,LuanTable env) throws LuanException { |
36 if( fileName == null ) | 36 if( fileName == null ) |
37 fileName = "stdin:"; | 37 fileName = "stdin:"; |
38 LuanFunction fn = PackageLuan.loader(luan,fileName,false,env); | 38 String src = PackageLuan.read(luan,fileName); |
39 if( fn == null ) | 39 if( src == null ) |
40 throw luan.exception( "file '"+fileName+"' not found" ); | 40 throw luan.exception( "file '"+fileName+"' not found" ); |
41 return fn; | 41 return load(luan,src,fileName,env,false); |
42 } | 42 } |
43 | 43 |
44 public static Object do_file(LuanState luan,String fileName) throws LuanException { | 44 public static Object do_file(LuanState luan,String fileName) throws LuanException { |
45 LuanFunction fn = load_file(luan,fileName,null); | 45 LuanFunction fn = load_file(luan,fileName,null); |
46 return luan.call(fn); | 46 return luan.call(fn); |