comparison src/luan/lib/HttpLib.java @ 142:05f8c21160ef

minor git-svn-id: https://luan-java.googlecode.com/svn/trunk@143 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 13 Jun 2014 17:05:31 +0000
parents f4ce03ff6b2f
children 1de3e4a6e82d
comparison
equal deleted inserted replaced
141:c2ee8a717b73 142:05f8c21160ef
21 import luan.LuanExitException; 21 import luan.LuanExitException;
22 import luan.DeepCloner; 22 import luan.DeepCloner;
23 23
24 24
25 public final class HttpLib { 25 public final class HttpLib {
26
27 public static final String NAME = "Http";
28 26
29 public static final LuanFunction LOADER = new LuanFunction() { 27 public static final LuanFunction LOADER = new LuanFunction() {
30 @Override public Object call(LuanState luan,Object[] args) { 28 @Override public Object call(LuanState luan,Object[] args) {
31 return new LuanTable(); // starts empty 29 return new LuanTable(); // starts empty
32 } 30 }
61 luan = cloner.deepClone(luan); 59 luan = cloner.deepClone(luan);
62 fn = cloner.get(fn); 60 fn = cloner.get(fn);
63 } 61 }
64 } 62 }
65 63
66 LuanTable module = (LuanTable)luan.loaded().get(NAME); 64 LuanTable module = (LuanTable)luan.loaded().get("Http");
67 if( module == null ) 65 if( module == null )
68 throw luan.exception( "module 'Http' not defined" ); 66 throw luan.exception( "module 'Http' not defined" );
69 HttpLib lib = new HttpLib(request,response); 67 HttpLib lib = new HttpLib(request,response);
70 try { 68 try {
71 module.put( "request", lib.requestTable() ); 69 module.put( "request", lib.requestTable() );