comparison src/luan/modules/ThreadLuan.java @ 1166:7ef40e1923b7

add back Thread.global allow metatables to have metatables
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 08 Feb 2018 02:22:51 -0700
parents 3ef883468fd0
children d3a3ca116e42
comparison
equal deleted inserted replaced
1165:668f29bc52ea 1166:7ef40e1923b7
1 package luan.modules; 1 package luan.modules;
2 2
3 import java.io.Closeable; 3 import java.io.Closeable;
4 import java.util.Arrays;
4 import java.util.Iterator; 5 import java.util.Iterator;
5 import java.util.Map; 6 import java.util.Map;
6 import java.util.HashMap; 7 import java.util.HashMap;
7 import java.util.LinkedHashMap; 8 import java.util.LinkedHashMap;
8 import java.util.concurrent.Executor; 9 import java.util.concurrent.Executor;
138 this.fns = (LuanTable)cloner.get(fns); 139 this.fns = (LuanTable)cloner.get(fns);
139 } 140 }
140 141
141 public synchronized Object call(String fnName,Object... args) throws LuanException { 142 public synchronized Object call(String fnName,Object... args) throws LuanException {
142 if( !isPrimitive(args) ) 143 if( !isPrimitive(args) )
143 throw new LuanException("can't pass non-primitive type to global_callable"); 144 throw new LuanException("can't pass non-primitive type to global_callable "+Arrays.asList(args));
144 Object f = fns.get(luan,fnName); 145 Object f = fns.get(luan,fnName);
145 if( f == null ) 146 if( f == null )
146 throw new LuanException("function '"+fnName+"' not found in global_callable"); 147 throw new LuanException("function '"+fnName+"' not found in global_callable");
147 if( !(f instanceof LuanFunction) ) 148 if( !(f instanceof LuanFunction) )
148 throw new LuanException("value of '"+fnName+"' not a function in global_callable"); 149 throw new LuanException("value of '"+fnName+"' not a function in global_callable");