diff src/luan/Lua.java @ 40:e3624b7cd603

implement stack trace git-svn-id: https://luan-java.googlecode.com/svn/trunk@41 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 21 Dec 2012 10:45:54 +0000
parents 8a57ebfdfd78
children 57054fa43189
line wrap: on
line diff
--- a/src/luan/Lua.java	Thu Dec 20 02:54:06 2012 +0000
+++ b/src/luan/Lua.java	Fri Dec 21 10:45:54 2012 +0000
@@ -26,13 +26,6 @@
 		return null;
 	}
 
-	public static String checkString(Object obj) throws LuaException {
-		String s = asString(obj);
-		if( s == null )
-			throw new LuaException( "attempt to use a " + Lua.type(obj) + " as a string" );
-		return s;
-	}
-
 	public static LuaNumber toNumber(Object obj) {
 		return toNumber(obj,null);
 	}
@@ -52,17 +45,8 @@
 		return null;
 	}
 
-	public static LuaNumber checkNumber(Object obj) throws LuaException {
-		LuaNumber n = toNumber(obj);
-		if( n == null )
-			throw new LuaException( "attempt to perform arithmetic on a " + type(obj) + " value" );
-		return n;
-	}
-
-	public static LuaFunction checkFunction(Object obj) throws LuaException {
-		if( obj instanceof LuaFunction )
-			return (LuaFunction)obj;
-		throw new LuaException( "attempt to call a " + type(obj) + " value" );
+	public static Object first(Object[] a) {
+		return a.length==0 ? null : a[0];
 	}
 
 }