comparison src/luan/lib/PackageLib.java @ 138:06159094b802

replace WebRun.java with web_run.luan git-svn-id: https://luan-java.googlecode.com/svn/trunk@139 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 12 Jun 2014 08:20:48 +0000
parents 7e160d2f6d9c
children c2ee8a717b73
comparison
equal deleted inserted replaced
137:573ce091ae00 138:06159094b802
129 129
130 130
131 public static final LuanFunction javaFileLoader = new LuanFunction() { 131 public static final LuanFunction javaFileLoader = new LuanFunction() {
132 @Override public Object call(LuanState luan,Object[] args) throws LuanException { 132 @Override public Object call(LuanState luan,Object[] args) throws LuanException {
133 String urlStr = (String)args[1]; 133 String urlStr = (String)args[1];
134 String path = (String)args[2];
134 try { 135 try {
135 String src = new IoLib.LuanUrl(urlStr).read_text(); 136 String src = new IoLib.LuanUrl(urlStr).read_text();
136 LuanFunction fn = BasicLib.load(luan,src,urlStr,false,false); 137 LuanFunction fn = BasicLib.load(luan,src,path,false,false);
137 return fn.call(luan,args); 138 return fn.call(luan,args);
138 } catch(IOException e) { 139 } catch(IOException e) {
139 throw luan.exception(e); 140 throw luan.exception(e);
140 } 141 }
141 } 142 }
144 public static final LuanFunction javaFileSearcher = new LuanFunction() { 145 public static final LuanFunction javaFileSearcher = new LuanFunction() {
145 @Override public Object[] call(LuanState luan,Object[] args) { 146 @Override public Object[] call(LuanState luan,Object[] args) {
146 String path = (String)args[0]; 147 String path = (String)args[0];
147 String url = IoLib.java_resource_to_url(path); 148 String url = IoLib.java_resource_to_url(path);
148 if( url != null ) { 149 if( url != null ) {
149 return new Object[]{javaFileLoader,url}; 150 return new Object[]{javaFileLoader,url,path};
150 } 151 }
151 return LuanFunction.NOTHING; 152 return LuanFunction.NOTHING;
152 } 153 }
153 }; 154 };
154 155