webmcp
view 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 | 
 line source
     1 --[[--
     2 return_value =            -- return value of executed chunk
     3 execute.load_chunk{
     4   file_path = file_path,  -- path to a lua source or byte-code file
     5   app       = app,        -- app name to use or the current will be used
     6   module    = module,     -- module where chunk is located
     7   chunk     = chunk       -- filename of lua file to load (including filename extension)
     8   id        = id,         -- id to be returned by param.get_id(...) during execution
     9   params    = params      -- parameters to be returned by param.get(...) during execution
    10 }
    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'.
    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.
    16 --]]--
    18 function execute.load_chunk(args)
    19   local chunk_name
    20   if args.chunk then
    21     chunk_name = string.match(args.chunk, "^(.*)%.lua$")
    22     if not chunk_name then
    23       error('"chunk_name" does not end with \'.lua\'')
    24     end
    25   end
    26   return execute.chunk{
    27     file_path = args.file_path,
    28     app       = args.app,
    29     module    = args.module,
    30     chunk     = chunk_name,
    31     id        = args.id,
    32     params    = args.params
    33   }
    34 end
