diff src/luan/lib/Utils.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 aa7538ae5fb6
children 6ca02b188dba
line wrap: on
line diff
--- a/src/luan/lib/Utils.java	Mon Feb 25 03:53:54 2013 +0000
+++ b/src/luan/lib/Utils.java	Wed Feb 27 08:03:51 2013 +0000
@@ -6,11 +6,19 @@
 import java.io.Reader;
 import java.io.IOException;
 import java.net.URL;
+import luan.LuanState;
+import luan.LuanException;
+import luan.LuanElement;
 
 
 public final class Utils {
 	private Utils() {}  // never
 
+	public static void checkNotNull(LuanState luan,Object v,String expected) throws LuanException {
+		if( v == null )
+			throw new LuanException(luan,LuanElement.JAVA,"bad argument #1 ("+expected+" expected, got nil)");
+	}
+
 	public static String readAll(Reader in)
 		throws IOException
 	{