diff core/src/luan/impl/LuanImpl.java @ 670:58ebfec6178b

all luan now compiles
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 12 Apr 2016 01:05:57 -0600
parents 71f8f5075df8
children d3e5414bdf4c
line wrap: on
line diff
--- a/core/src/luan/impl/LuanImpl.java	Mon Apr 11 16:00:44 2016 -0600
+++ b/core/src/luan/impl/LuanImpl.java	Tue Apr 12 01:05:57 2016 -0600
@@ -14,7 +14,7 @@
 public final class LuanImpl {
 	private LuanImpl() {}  // never
 
-
+/*
 	private static List list = new ArrayList();
 
 	static int addObj(Object obj) {
@@ -26,7 +26,7 @@
 	public static Object getObj(int i) {
 		return list.get(i);
 	}
-
+*/
 
 	public static int len(LuanState luan,Object o) throws LuanException {
 		if( o instanceof String ) {
@@ -170,7 +170,7 @@
 
 	public static void nop(Object o) {}
 
-
+/*
 	public static void set(LuanStateImpl luan,Settable[] vars,Object obj) throws LuanException {
 		if( obj instanceof Object[] ) {
 			Object[] vals = (Object[])obj;
@@ -185,7 +185,7 @@
 			}
 		}
 	}
-
+*/
 	public static void put(LuanState luan,Object t,Object key,Object value) throws LuanException {
 		if( t instanceof LuanTable ) {
 			LuanTable tbl = (LuanTable)t;
@@ -207,6 +207,17 @@
 		return i<a.length ? a[i] : null;
 	}
 
+	public static Object[] varArgs(Object o,int i) {
+		if( !(o instanceof Object[]) )
+			return i==0 ? new Object[]{o} : LuanFunction.NOTHING;
+		Object[] a = (Object[])o;
+		if( i >= a.length )
+			return LuanFunction.NOTHING;
+		Object[] rtn = new Object[a.length - i];
+		System.arraycopy(a,i,rtn,0,rtn.length);
+		return rtn;
+	}
+
 	public static Object[] concatArgs(Object o1,Object o2) {
 		if( o1 instanceof Object[] ) {
 			Object[] a1 = (Object[])o1;