Mercurial Hosting > luan
comparison src/luan/lib/JavaLib.java @ 74:f003338d503b
improve package lib
git-svn-id: https://luan-java.googlecode.com/svn/trunk@75 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 13 Feb 2013 06:27:56 +0000 |
parents | f86e4f77ef32 |
children | 4bf3d0c0b6b9 |
comparison
equal
deleted
inserted
replaced
73:f86e4f77ef32 | 74:f003338d503b |
---|---|
32 public static final LuanFunction LOADER = new LuanFunction() { | 32 public static final LuanFunction LOADER = new LuanFunction() { |
33 public Object[] call(LuanState luan,Object[] args) throws LuanException { | 33 public Object[] call(LuanState luan,Object[] args) throws LuanException { |
34 luan.addMetatableGetter(mg); | 34 luan.addMetatableGetter(mg); |
35 LuanTable module = new LuanTable(); | 35 LuanTable module = new LuanTable(); |
36 LuanTable global = luan.global; | 36 LuanTable global = luan.global; |
37 global.put(NAME,module); | |
38 try { | 37 try { |
39 global.put( "import", new LuanJavaFunction(JavaLib.class.getMethod("importClass",LuanState.class,String.class),null) ); | 38 global.put( "import", new LuanJavaFunction(JavaLib.class.getMethod("importClass",LuanState.class,String.class),null) ); |
40 module.put( "class", new LuanJavaFunction(JavaLib.class.getMethod("getClass",LuanState.class,String.class),null) ); | 39 module.put( "class", new LuanJavaFunction(JavaLib.class.getMethod("getClass",LuanState.class,String.class),null) ); |
41 add( module, "proxy", LuanState.class, Static.class, LuanTable.class, Object.class ); | 40 add( module, "proxy", LuanState.class, Static.class, LuanTable.class, Object.class ); |
42 } catch(NoSuchMethodException e) { | 41 } catch(NoSuchMethodException e) { |
43 throw new RuntimeException(e); | 42 throw new RuntimeException(e); |
44 } | 43 } |
45 return LuanFunction.EMPTY_RTN; | 44 return new Object[]{module}; |
46 } | 45 } |
47 }; | 46 }; |
48 | 47 |
49 private static final LuanTable mt = new LuanTable(); | 48 private static final LuanTable mt = new LuanTable(); |
50 static { | 49 static { |