diff core/src/luan/modules/PackageLuan.java @ 207:5aafb5b9f70f

various git-svn-id: https://luan-java.googlecode.com/svn/trunk@208 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Tue, 08 Jul 2014 02:04:24 +0000
parents 75750ceb45ee
children 5ba136769034
line wrap: on
line diff
--- a/core/src/luan/modules/PackageLuan.java	Mon Jul 07 23:55:52 2014 +0000
+++ b/core/src/luan/modules/PackageLuan.java	Tue Jul 08 02:04:24 2014 +0000
@@ -27,7 +27,8 @@
 			module.put( "jpath", jpath );
 			try {
 				module.put("require",requireFn);
-				add( module, "block_lib", LuanState.class, String.class );
+				add( module, "block_path", LuanState.class, String.class );
+				add( module, "is_blocked_path", LuanState.class, String.class );
 				add( module, "load", LuanState.class, String.class );
 				add( module, "load_lib", LuanState.class, String.class );
 				add( module, "search_path", String.class, String.class );
@@ -203,14 +204,18 @@
 	};
 
 
-	public static void block_lib(LuanState luan,String path) {
+	public static void block_path(LuanState luan,String path) {
 		blocked(luan).put(path,true);
 	}
 
+	public static boolean is_blocked_path(LuanState luan,String path) {
+		return blocked(luan).get(path) != null;
+	}
+
 	public static LuanFunction load_lib(LuanState luan,String path)
 		throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, LuanException
 	{
-		if( blocked(luan).get(path) != null )
+		if( is_blocked_path(luan,path) )
 			throw luan.exception(path+" is blocked");
 		int i = path.lastIndexOf('.');
 		String clsPath = path.substring(0,i);