webmcp

view framework/env/execute/load_chunk.lua @ 205:48ee8826efbe

Correct handling of nil's in return tuples in execute.chunk{...}
author jbe
date Fri Jan 09 21:32:23 2015 +0100 (2015-01-09)
parents 209a686464a1
children eb3e236d261d
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
15 a path to load from the module and chunk name.
17 --]]--
19 function execute.load_chunk(args)
20 local chunk_name
21 if args.chunk then
22 chunk_name = string.match(args.chunk, "^(.*)%.lua$")
23 if not chunk_name then
24 error('"chunk_name" does not end with \'.lua\'')
25 end
26 end
27 return execute.chunk{
28 file_path = args.file_path,
29 app = args.app,
30 module = args.module,
31 chunk = chunk_name,
32 id = args.id,
33 params = args.params
34 }
35 end

Impressum / About Us