Mercurial Hosting > luan
changeset 1857:0c0b0acf780d default tip
fix shell
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 05 Mar 2025 21:41:22 -0700 |
parents | 1b5a8b4fc971 |
children | |
files | src/luan/modules/ThreadLuan.java |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/modules/ThreadLuan.java Thu Feb 27 19:32:10 2025 +0200 +++ b/src/luan/modules/ThreadLuan.java Wed Mar 05 21:41:22 2025 -0700 @@ -129,18 +129,19 @@ public static final class Callable { private long expires; - private final Luan luan = new Luan(); + private final Luan luan; private final LuanTable fns; - Callable(LuanFunction initFn) throws LuanException { + Callable(Luan luan,LuanFunction initFn) throws LuanException { + this.luan = new Luan(luan); LuanMutable.makeImmutable(initFn); Object obj = initFn.call(luan); if( !(obj instanceof LuanTable) ) throw new LuanException("global_callable init_fn must return a table"); - this.fns = (LuanTable)initFn.call(luan); + this.fns = (LuanTable)obj; } - public synchronized Object call(Luan callerLuan,String fnName,Object... args) throws LuanException { + public synchronized Object call(String fnName,Object... args) throws LuanException { LuanMutable.makeImmutable(args); Object f = fns.get(luan,fnName); if( f == null ) @@ -174,7 +175,7 @@ Callable callable = callableMap.get(name); if( callable == null ) { sweep(callableMap,now); - callable = new Callable(initFn); + callable = new Callable(luan,initFn); callableMap.put(name,callable); } callable.expires = now + timeout;