diff src/luan/lib/PackageLib.java @ 77:4bf3d0c0b6b9

make LuanState cloneable git-svn-id: https://luan-java.googlecode.com/svn/trunk@78 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 15 Feb 2013 09:55:17 +0000
parents aa7538ae5fb6
children cca4f8522893
line wrap: on
line diff
--- a/src/luan/lib/PackageLib.java	Fri Feb 15 04:52:16 2013 +0000
+++ b/src/luan/lib/PackageLib.java	Fri Feb 15 09:55:17 2013 +0000
@@ -19,10 +19,10 @@
 
 	public static final LuanFunction LOADER = new LuanFunction() {
 		public Object[] call(LuanState luan,Object[] args) throws LuanException {
-			LuanTable global = luan.global;
+			LuanTable global = luan.global();
 			LuanTable module = new LuanTable();
-			module.put("loaded",luan.loaded);
-			module.put("preload",luan.preload);
+			module.put("loaded",luan.loaded());
+			module.put("preload",luan.preload());
 //			module.put("path","?.lua");
 			try {
 				add( global, "require", LuanState.class, String.class );
@@ -43,11 +43,11 @@
 	public static void require(LuanState luan,String modName) throws LuanException {
 		Object mod = module(luan,modName);
 		if( mod instanceof LuanTable )
-			luan.global.put(modName,mod);
+			luan.global().put(modName,mod);
 	}
 
 	public static Object module(LuanState luan,String modName) throws LuanException {
-		Object mod = luan.loaded.get(modName);
+		Object mod = luan.loaded().get(modName);
 		if( mod == null ) {
 			LuanTable searchers = (LuanTable)luan.get("package.searchers");
 			for( Object s : searchers.asList() ) {
@@ -59,7 +59,7 @@
 					mod = Luan.first(luan.call(loader,LuanElement.JAVA,"loader",modName,extra));
 					if( mod == null )
 						mod = true;
-					luan.loaded.put(modName,mod);
+					luan.loaded().put(modName,mod);
 				}
 			}
 			if( mod == null )
@@ -100,7 +100,7 @@
 	public static final LuanFunction preloadSearcher = new LuanFunction() {
 		public Object[] call(LuanState luan,Object[] args) throws LuanException {
 			String modName = (String)args[0];
-			return new Object[]{luan.preload.get(modName)};
+			return new Object[]{luan.preload().get(modName)};
 		}
 	};