Mercurial Hosting > luan
comparison core/src/luan/modules/PackageLuan.java @ 186:cf939124461a
don't import modules by default
git-svn-id: https://luan-java.googlecode.com/svn/trunk@187 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 26 Jun 2014 00:36:50 +0000 |
parents | bdbd4740121f |
children | 24ede40ee0aa |
comparison
equal
deleted
inserted
replaced
185:5f50dba8ac7d | 186:cf939124461a |
---|---|
23 module.put("loaded",luan.loaded()); | 23 module.put("loaded",luan.loaded()); |
24 module.put("preload",luan.preload()); | 24 module.put("preload",luan.preload()); |
25 module.put("path","?.luan;java:luan/modules/?.luan"); | 25 module.put("path","?.luan;java:luan/modules/?.luan"); |
26 module.put("jpath",jpath); | 26 module.put("jpath",jpath); |
27 try { | 27 try { |
28 add( module, "require", LuanState.class, String.class ); | 28 module.put("require",requireFn); |
29 add( module, "load", LuanState.class, String.class ); | 29 add( module, "load", LuanState.class, String.class ); |
30 add( module, "load_lib", String.class ); | 30 add( module, "load_lib", String.class ); |
31 add( module, "search_path", String.class, String.class ); | 31 add( module, "search_path", String.class, String.class ); |
32 add( module, "search", LuanState.class, String.class ); | 32 add( module, "search", LuanState.class, String.class ); |
33 } catch(NoSuchMethodException e) { | 33 } catch(NoSuchMethodException e) { |
39 searchers.add(javaSearcher); | 39 searchers.add(javaSearcher); |
40 module.put("searchers",searchers); | 40 module.put("searchers",searchers); |
41 return module; | 41 return module; |
42 } | 42 } |
43 }; | 43 }; |
44 | |
45 public static final LuanFunction requireFn; | |
46 static { | |
47 try { | |
48 requireFn = new LuanJavaFunction(PackageLuan.class.getMethod("require",LuanState.class,String.class),null); | |
49 } catch(NoSuchMethodException e) { | |
50 throw new RuntimeException(e); | |
51 } | |
52 } | |
44 | 53 |
45 private static void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException { | 54 private static void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException { |
46 t.put( method, new LuanJavaFunction(PackageLuan.class.getMethod(method,parameterTypes),null) ); | 55 t.put( method, new LuanJavaFunction(PackageLuan.class.getMethod(method,parameterTypes),null) ); |
47 } | 56 } |
48 | 57 |