diff core/src/luan/modules/BasicLuan.java @ 265:454a486d9c19

allow IO on files that don't exist git-svn-id: https://luan-java.googlecode.com/svn/trunk@266 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Wed, 29 Oct 2014 16:26:42 +0000
parents 9e0d4452e649
children 9a0cc6d9b27b
line wrap: on
line diff
--- a/core/src/luan/modules/BasicLuan.java	Wed Oct 29 03:50:59 2014 +0000
+++ b/core/src/luan/modules/BasicLuan.java	Wed Oct 29 16:26:42 2014 +0000
@@ -74,11 +74,12 @@
 	}
 
 	public static LuanFunction load_file(LuanState luan,String fileName) throws LuanException {
-		LuanTable t = fileName==null ? IoLuan.stdin.table() : IoLuan.get(luan,fileName,false);
-		if( t == null )
+		if( fileName == null )
+			fileName = "stdin:";
+		LuanFunction fn = PackageLuan.loader(luan,fileName,false);
+		if( fn == null )
 			throw luan.exception( "file '"+fileName+"' not found" );
-		LuanFunction loader = (LuanFunction)t.get("loader");
-		return (LuanFunction)Luan.first(luan.call(loader,new Object[]{fileName}));
+		return fn;
 	}
 
 	public static Object do_file(LuanState luan,String fileName) throws LuanException {