Mercurial Hosting > luan
diff core/src/luan/impl/LuanImpl.java @ 655:e2be71451d04
compile TableExpr
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 05 Apr 2016 15:28:07 -0600 |
parents | ea7dbd2dfa65 |
children | e064377994b2 |
line wrap: on
line diff
--- a/core/src/luan/impl/LuanImpl.java Tue Apr 05 14:16:14 2016 -0600 +++ b/core/src/luan/impl/LuanImpl.java Tue Apr 05 15:28:07 2016 -0600 @@ -242,4 +242,23 @@ } } + public static LuanTable table(Object o) { + LuanTable table = new LuanTable(); + int i = 0; + for( Object fld : Luan.array(o) ) { + if( fld instanceof TableField ) { + TableField tblFld = (TableField)fld; + Object key = tblFld.key; + Object value = tblFld.value; + if( key != null && value != null ) + table.rawPut(key,value); + } else { + i++; + if( fld != null ) + table.rawPut(i,fld); + } + } + return table; + } + }