annotate framework/env/execute/load_chunk.lua @ 222:38e5399718ca
Use request.get_param{...} and request.get_param_strings{...} functions in request.process()
 | author | jbe | 
 | date | Fri Feb 27 17:18:08 2015 +0100 (2015-02-27) | 
 | parents | eb3e236d261d | 
 | children |  | 
 
 | rev | line source | 
| poelzi@31 | 1 --[[-- | 
| jbe@46 | 2 return_value =            -- return value of executed chunk | 
| poelzi@31 | 3 execute.load_chunk{ | 
| poelzi@31 | 4   file_path = file_path,  -- path to a lua source or byte-code file | 
| poelzi@31 | 5   app       = app,        -- app name to use or the current will be used | 
| poelzi@31 | 6   module    = module,     -- module where chunk is located | 
| jbe@46 | 7   chunk     = chunk       -- filename of lua file to load (including filename extension) | 
| poelzi@32 | 8   id        = id,         -- id to be returned by param.get_id(...) during execution | 
| poelzi@32 | 9   params    = params      -- parameters to be returned by param.get(...) during execution | 
| poelzi@31 | 10 } | 
| poelzi@31 | 11 | 
| jbe@46 | 12 NOTE: execute.load_chunk{...} is DEPRECATED and replaced by execute.chunk{...}. Both functions differ in interpretation of argument "chunk" regarding the filename extenstion '.lua'. | 
| jbe@46 | 13 | 
| jbe@206 | 14 This function loads and executes a lua file specified by a given path or constructs a path to load from the module and chunk name. | 
| poelzi@31 | 15 | 
| poelzi@31 | 16 --]]-- | 
| poelzi@31 | 17 | 
| poelzi@31 | 18 function execute.load_chunk(args) | 
| jbe@46 | 19   local chunk_name | 
| jbe@46 | 20   if args.chunk then | 
| jbe@46 | 21     chunk_name = string.match(args.chunk, "^(.*)%.lua$") | 
| jbe@46 | 22     if not chunk_name then | 
| jbe@46 | 23       error('"chunk_name" does not end with \'.lua\'') | 
| jbe@46 | 24     end | 
| poelzi@31 | 25   end | 
| jbe@46 | 26   return execute.chunk{ | 
| jbe@46 | 27     file_path = args.file_path, | 
| jbe@46 | 28     app       = args.app, | 
| jbe@46 | 29     module    = args.module, | 
| jbe@46 | 30     chunk     = chunk_name, | 
| jbe@46 | 31     id        = args.id, | 
| jbe@46 | 32     params    = args.params | 
| jbe@46 | 33   } | 
| poelzi@31 | 34 end |