Mercurial Hosting > luan
diff src/luan/lib/TableLib.java @ 86:6db8f286fa6c
_ENV is per module, not global
git-svn-id: https://luan-java.googlecode.com/svn/trunk@87 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 27 Feb 2013 08:03:51 +0000 |
parents | 4bf3d0c0b6b9 |
children | 6ca02b188dba |
line wrap: on
line diff
--- a/src/luan/lib/TableLib.java Mon Feb 25 03:53:54 2013 +0000 +++ b/src/luan/lib/TableLib.java Wed Feb 27 08:03:51 2013 +0000 @@ -7,6 +7,7 @@ import luan.LuanState; import luan.LuanTable; import luan.LuanFunction; +import luan.LuanLoader; import luan.LuanJavaFunction; import luan.LuanElement; import luan.LuanException; @@ -17,10 +18,9 @@ public static final String NAME = "table"; - public static final LuanFunction LOADER = new LuanFunction() { - public Object[] call(LuanState luan,Object[] args) throws LuanException { + public static final LuanLoader LOADER = new LuanLoader() { + @Override protected void load(LuanState luan) { LuanTable module = new LuanTable(); - LuanTable global = luan.global(); try { add( module, "concat", LuanState.class, LuanTable.class, String.class, Integer.class, Integer.class ); add( module, "insert", LuanState.class, LuanTable.class, Integer.TYPE, Object.class ); @@ -32,7 +32,7 @@ } catch(NoSuchMethodException e) { throw new RuntimeException(e); } - return new Object[]{module}; + luan.loaded().put(NAME,module); } };