Mercurial Hosting > luan
comparison src/luan/modules/BasicLuan.java @ 1424:9ab267b9427c
better load_file()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 22 Nov 2019 22:58:39 -0700 |
parents | 225808b90cee |
children | 56fb5cd8228d |
comparison
equal
deleted
inserted
replaced
1423:2c06a7ff4173 | 1424:9ab267b9427c |
---|---|
28 { | 28 { |
29 Utils.checkNotNull(text); | 29 Utils.checkNotNull(text); |
30 Utils.checkNotNull(sourceName,1); | 30 Utils.checkNotNull(sourceName,1); |
31 return luan.load(text,sourceName,env); | 31 return luan.load(text,sourceName,env); |
32 } | 32 } |
33 | 33 /* |
34 public static LuanFunction load_file(Luan luan,String fileName) throws LuanException { | 34 public static LuanFunction load_file(Luan luan,String fileName) throws LuanException { |
35 if( fileName == null ) { | 35 if( fileName == null ) { |
36 fileName = "stdin:"; | 36 fileName = "stdin:"; |
37 } else if( fileName.indexOf(':') == -1 ) { | 37 } else if( fileName.indexOf(':') == -1 ) { |
38 fileName = "file:" + fileName; | 38 fileName = "file:" + fileName; |
40 String src = PackageLuan.read(luan,fileName); | 40 String src = PackageLuan.read(luan,fileName); |
41 if( src == null ) | 41 if( src == null ) |
42 return null; | 42 return null; |
43 return load(luan,src,fileName,null); | 43 return load(luan,src,fileName,null); |
44 } | 44 } |
45 | 45 */ |
46 public static LuanFunction pairs(final LuanTable t) throws LuanException { | 46 public static LuanFunction pairs(final LuanTable t) throws LuanException { |
47 Utils.checkNotNull(t); | 47 Utils.checkNotNull(t); |
48 return t.pairs(); | 48 return t.pairs(); |
49 } | 49 } |
50 | 50 |