Mercurial Hosting > luan
comparison src/luan/modules/http/LuanHandler.java @ 1283:503bde9a7c80
add luan.require() and table.call()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 21 Dec 2018 09:12:09 -0700 |
parents | 9fa8b8389578 |
children | f7355714742f |
comparison
equal
deleted
inserted
replaced
1282:2531942abaf3 | 1283:503bde9a7c80 |
---|---|
53 this.luanInit = luanInit; | 53 this.luanInit = luanInit; |
54 if( loggerRoot==null ) | 54 if( loggerRoot==null ) |
55 loggerRoot = ""; | 55 loggerRoot = ""; |
56 logger = LoggerFactory.getLogger(loggerRoot+LuanHandler.class.getName()); | 56 logger = LoggerFactory.getLogger(loggerRoot+LuanHandler.class.getName()); |
57 try { | 57 try { |
58 LuanTable Http = (LuanTable)PackageLuan.require(luanInit,"luan:http/Http.luan"); | 58 LuanTable Http = (LuanTable)luanInit.require("luan:http/Http.luan"); |
59 Http.rawPut( "reset_luan", new LuanJavaFunction(resetLuanMethod,this) ); | 59 Http.put( "reset_luan", new LuanJavaFunction(resetLuanMethod,this) ); |
60 Http.rawPut( "eval_in_root", new LuanJavaFunction(evalInRootMethod,this) ); | 60 Http.put( "eval_in_root", new LuanJavaFunction(evalInRootMethod,this) ); |
61 } catch(LuanException e) { | 61 } catch(LuanException e) { |
62 throw new RuntimeException(e); | 62 throw new RuntimeException(e); |
63 } | 63 } |
64 currentLuan = newLuan(); | 64 currentLuan = newLuan(); |
65 } | 65 } |
134 try { | 134 try { |
135 LuanFunction fn; | 135 LuanFunction fn; |
136 LuanState luan = currentLuan; | 136 LuanState luan = currentLuan; |
137 synchronized(luan) { | 137 synchronized(luan) { |
138 PackageLuan.enableLoad(luan,"luan:Rpc.luan"); | 138 PackageLuan.enableLoad(luan,"luan:Rpc.luan"); |
139 LuanTable rpc = (LuanTable)PackageLuan.require(luan,"luan:Rpc.luan"); | 139 LuanTable rpc = (LuanTable)luan.require("luan:Rpc.luan"); |
140 LuanTable fns = (LuanTable)rpc.get("functions"); | 140 LuanTable fns = (LuanTable)rpc.get("functions"); |
141 fn = (LuanFunction)fns.get(fnName); | 141 fn = (LuanFunction)fns.get(fnName); |
142 if( fn == null ) | 142 if( fn == null ) |
143 throw new LuanException( "function not found: " + fnName ); | 143 throw new LuanException( "function not found: " + fnName ); |
144 LuanCloner cloner = new LuanCloner(LuanCloner.Type.INCREMENTAL); | 144 LuanCloner cloner = new LuanCloner(LuanCloner.Type.INCREMENTAL); |