Mercurial Hosting > luan
diff core/src/luan/impl/LuanImpl.java @ 660:e064377994b2
compile table put
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 06 Apr 2016 21:06:29 -0600 |
parents | e2be71451d04 |
children | ee00a619eec1 |
line wrap: on
line diff
--- a/core/src/luan/impl/LuanImpl.java Tue Apr 05 20:30:42 2016 -0600 +++ b/core/src/luan/impl/LuanImpl.java Wed Apr 06 21:06:29 2016 -0600 @@ -8,6 +8,7 @@ import luan.LuanTable; import luan.LuanFunction; import luan.LuanException; +import luan.modules.JavaLuan; public final class LuanImpl { @@ -211,6 +212,18 @@ } } + public static void put(LuanState luan,Object t,Object key,Object value) throws LuanException { + if( t instanceof LuanTable ) { + LuanTable tbl = (LuanTable)t; + tbl.put(luan,key,value); + return; + } + if( t != null && luan.hasJava() ) + JavaLuan.__new_index(luan,t,key,value); + else + throw new LuanException( "attempt to index a " + Luan.type(t) + " value" ); + } + public static Object[] concatArgs(Object o1,Object o2) { if( o1 instanceof Object[] ) { Object[] a1 = (Object[])o1;