Mercurial Hosting > luan
diff web/src/luan/modules/web/HttpServicer.java @ 426:23a93c118042
fix LuanTable.get() to use metatables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 May 2015 18:44:20 -0600 |
parents | 91af5337b9ae |
children | dae264ad6a7b |
line wrap: on
line diff
--- a/web/src/luan/modules/web/HttpServicer.java Fri May 01 17:18:23 2015 -0600 +++ b/web/src/luan/modules/web/HttpServicer.java Fri May 01 18:44:20 2015 -0600 @@ -51,7 +51,7 @@ if( !(mod instanceof LuanTable) ) throw luan.exception( "module '"+modName+"' must return a table" ); LuanTable tbl = (LuanTable)mod; - if( Luan.toBoolean( tbl.get("per_session") ) ) { + if( Luan.toBoolean( tbl.get(luan,"per_session") ) ) { HttpSession session = request.getSession(); LuanState sessionLuan = (LuanState)session.getValue("luan"); if( sessionLuan!=null ) { @@ -71,9 +71,7 @@ } } - LuanTable module = (LuanTable)PackageLuan.loaded(luan).get("luan:web/Http"); - if( module == null ) - throw luan.exception( "module 'web/Http' not defined" ); + LuanTable module = (LuanTable)PackageLuan.require(luan,"luan:web/Http"); HttpServicer lib = new HttpServicer(request,response); try { module.put( "request", lib.requestTable() ); @@ -99,7 +97,7 @@ private static LuanFunction getService(LuanState luan,LuanTable tbl) throws LuanException { - Object service = tbl.get("service"); + Object service = tbl.get(luan,"service"); if( service == null ) throw luan.exception( "function 'service' is not defined" ); if( !(service instanceof LuanFunction) )