Mercurial Hosting > luan
diff src/luan/modules/BasicLuan.java @ 1267:9fa8b8389578
add LuanTable.luan;
support metatable __gc();
add luan.sql;
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 12 Nov 2018 02:10:41 -0700 |
parents | e38f5869e9df |
children | 623dfe0e2e73 |
line wrap: on
line diff
--- a/src/luan/modules/BasicLuan.java Sun Sep 30 19:10:48 2018 -0600 +++ b/src/luan/modules/BasicLuan.java Mon Nov 12 02:10:41 2018 -0700 @@ -43,9 +43,9 @@ return load(src,fileName,null); } - public static LuanFunction pairs(final LuanState luan,final LuanTable t) throws LuanException { + public static LuanFunction pairs(final LuanTable t) throws LuanException { Utils.checkNotNull(t); - return t.pairs(luan); + return t.pairs(); } public static LuanFunction ipairs(final LuanTable t) throws LuanException { @@ -73,9 +73,9 @@ return obj!=null ? obj : metatable; } - public static void set_metatable(LuanState luan,LuanTable table,LuanTable metatable) throws LuanException { + public static void set_metatable(LuanTable table,LuanTable metatable) throws LuanException { Utils.checkNotNull(table); - if( table.getHandler(luan,"__metatable") != null ) + if( table.getHandler("__metatable") != null ) throw new LuanException("cannot change a protected metatable"); table.setMetatable(metatable); } @@ -110,7 +110,7 @@ public static LuanTable new_error(LuanState luan,Object msg) throws LuanException { String s = luan.toString(msg); - LuanTable tbl = new LuanException(s).table(); + LuanTable tbl = new LuanException(s).table(luan); tbl.rawPut( "message", msg ); return tbl; } @@ -166,21 +166,21 @@ public static Object try_(LuanState luan,LuanTable blocks,Object... args) throws LuanException { Utils.checkNotNull(blocks); - Object obj = blocks.get(luan,1); + Object obj = blocks.get(1); if( obj == null ) throw new LuanException("missing 'try' value"); if( !(obj instanceof LuanFunction) ) throw new LuanException("bad 'try' value (function expected, got "+Luan.type(obj)+")"); LuanFunction tryFn = (LuanFunction)obj; LuanFunction catchFn = null; - obj = blocks.get(luan,"catch"); + obj = blocks.get("catch"); if( obj != null ) { if( !(obj instanceof LuanFunction) ) throw new LuanException("bad 'catch' value (function expected, got "+Luan.type(obj)+")"); catchFn = (LuanFunction)obj; } LuanFunction finallyFn = null; - obj = blocks.get(luan,"finally"); + obj = blocks.get("finally"); if( obj != null ) { if( !(obj instanceof LuanFunction) ) throw new LuanException("bad 'finally' value (function expected, got "+Luan.type(obj)+")"); @@ -191,7 +191,7 @@ } catch(LuanException e) { if( catchFn == null ) throw e; - return catchFn.call(luan,new Object[]{e.table()}); + return catchFn.call(luan,new Object[]{e.table(luan)}); } finally { if( finallyFn != null ) finallyFn.call(luan); @@ -208,7 +208,7 @@ } return rtn; } catch(LuanException e) { - return new Object[]{false,e.table()}; + return new Object[]{false,e.table(luan)}; } }