Mercurial Hosting > luan
diff src/luan/lib/TableLib.java @ 49:8ede219cd111
add WebShell
git-svn-id: https://luan-java.googlecode.com/svn/trunk@50 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 28 Dec 2012 19:35:04 +0000 |
parents | 64ecb7a3aad7 |
children | f86e4f77ef32 |
line wrap: on
line diff
--- a/src/luan/lib/TableLib.java Fri Dec 28 03:29:12 2012 +0000 +++ b/src/luan/lib/TableLib.java Fri Dec 28 19:35:04 2012 +0000 @@ -14,9 +14,9 @@ public final class TableLib { - public static void register(LuanState lua) { + public static void register(LuanState luan) { LuanTable module = new LuanTable(); - LuanTable global = lua.global(); + LuanTable global = luan.global(); global.put("table",module); try { add( module, "concat", LuanState.class, LuanTable.class, String.class, Integer.class, Integer.class ); @@ -35,7 +35,7 @@ t.put( method, new LuanJavaFunction(TableLib.class.getMethod(method,parameterTypes),null) ); } - public static String concat(LuanState lua,LuanTable list,String sep,Integer i,Integer j) throws LuanException { + public static String concat(LuanState luan,LuanTable list,String sep,Integer i,Integer j) throws LuanException { int first = i==null ? 1 : i; int last = j==null ? list.length() : j; StringBuilder buf = new StringBuilder(); @@ -47,25 +47,25 @@ buf.append(sep); String s = Luan.asString(val); if( s==null ) - throw new LuanException( lua, LuanElement.JAVA, "invalid value ("+Luan.type(val)+") at index "+k+" in table for 'concat'" ); + throw new LuanException( luan, LuanElement.JAVA, "invalid value ("+Luan.type(val)+") at index "+k+" in table for 'concat'" ); buf.append(val); } return buf.toString(); } - public static void insert(LuanState lua,LuanTable list,int pos,Object value) throws LuanException { + public static void insert(LuanState luan,LuanTable list,int pos,Object value) throws LuanException { try { list.insert(pos,value); } catch(IndexOutOfBoundsException e) { - throw new LuanException( lua, LuanElement.JAVA, e); + throw new LuanException( luan, LuanElement.JAVA, e); } } - public static Object remove(LuanState lua,LuanTable list,int pos) throws LuanException { + public static Object remove(LuanState luan,LuanTable list,int pos) throws LuanException { try { return list.remove(pos); } catch(IndexOutOfBoundsException e) { - throw new LuanException( lua, LuanElement.JAVA, e); + throw new LuanException( luan, LuanElement.JAVA, e); } } @@ -73,13 +73,13 @@ public boolean isLessThan(Object o1,Object o2); } - public static void sort(final LuanState lua,LuanTable list,final LuanFunction comp) throws LuanException { + public static void sort(final LuanState luan,LuanTable list,final LuanFunction comp) throws LuanException { final LessThan lt; if( comp==null ) { lt = new LessThan() { public boolean isLessThan(Object o1,Object o2) { try { - return lua.isLessThan(LuanElement.JAVA,o1,o2); + return luan.isLessThan(LuanElement.JAVA,o1,o2); } catch(LuanException e) { throw new LuanRuntimeException(e); } @@ -89,7 +89,7 @@ lt = new LessThan() { public boolean isLessThan(Object o1,Object o2) { try { - return Luan.toBoolean(Luan.first(lua.call(comp,LuanElement.JAVA,"comp-arg",o1,o2))); + return Luan.toBoolean(Luan.first(luan.call(comp,LuanElement.JAVA,"comp-arg",o1,o2))); } catch(LuanException e) { throw new LuanRuntimeException(e); }