webmcp
annotate framework/env/execute/load_chunk.lua @ 110:0c4841af07a5
String truncating by counting Unicode codepoints in format.string(...)
(grapheme cluster boundary detection not implemented)
(grapheme cluster boundary detection not implemented)
| author | jbe |
|---|---|
| date | Sun Jan 12 03:57:47 2014 +0100 (2014-01-12) |
| parents | 209a686464a1 |
| children | eb3e236d261d |
| 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 |
| poelzi@31 | 14 This function loads and executes a lua file specified by a given path or constructs |
| poelzi@31 | 15 a path to load from the module and chunk name. |
| poelzi@31 | 16 |
| poelzi@31 | 17 --]]-- |
| poelzi@31 | 18 |
| poelzi@31 | 19 function execute.load_chunk(args) |
| jbe@46 | 20 local chunk_name |
| jbe@46 | 21 if args.chunk then |
| jbe@46 | 22 chunk_name = string.match(args.chunk, "^(.*)%.lua$") |
| jbe@46 | 23 if not chunk_name then |
| jbe@46 | 24 error('"chunk_name" does not end with \'.lua\'') |
| jbe@46 | 25 end |
| poelzi@31 | 26 end |
| jbe@46 | 27 return execute.chunk{ |
| jbe@46 | 28 file_path = args.file_path, |
| jbe@46 | 29 app = args.app, |
| jbe@46 | 30 module = args.module, |
| jbe@46 | 31 chunk = chunk_name, |
| jbe@46 | 32 id = args.id, |
| jbe@46 | 33 params = args.params |
| jbe@46 | 34 } |
| poelzi@31 | 35 end |