annotate framework/env/execute/action.lua @ 485:9b7a391fd461
Updated documentation on passing moonbridge_io.poll to main handlers
 | author | 
 jbe | 
 | date | 
 Sun Jun 11 22:31:17 2017 +0200 (2017-06-11) | 
 | parents | 
 f28b3c671378  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
jbe/bsw@0
 | 
     1 --[[--
 | 
| 
jbe@353
 | 
     2 action_status =                    -- status code returned by action (a string), or, if "test_existence" == true, a boolean
 | 
| 
jbe/bsw@0
 | 
     3 execute.action{
 | 
| 
jbe@352
 | 
     4   module         = module,         -- module name of the action to be executed
 | 
| 
jbe@352
 | 
     5   action         = action,         -- name of the action to be executed
 | 
| 
jbe@352
 | 
     6   id             = id,             -- id to be returned by param.get_id(...) during execution
 | 
| 
jbe@352
 | 
     7   params         = params,         -- parameters to be returned by param.get(...) during execution
 | 
| 
jbe@352
 | 
     8   test_existence = test_existence  -- do not execute action but only check if it exists
 | 
| 
jbe/bsw@0
 | 
     9 }
 | 
| 
jbe/bsw@0
 | 
    10 
 | 
| 
jbe/bsw@0
 | 
    11 Executes an action without associated filters.
 | 
| 
jbe/bsw@0
 | 
    12 
 | 
| 
jbe/bsw@0
 | 
    13 --]]--
 | 
| 
jbe/bsw@0
 | 
    14 
 | 
| 
jbe/bsw@0
 | 
    15 function execute.action(args)
 | 
| 
jbe/bsw@0
 | 
    16   local module = args.module
 | 
| 
jbe/bsw@0
 | 
    17   local action = args.action
 | 
| 
jbe@352
 | 
    18   local test   = args.test_existence
 | 
| 
jbe@352
 | 
    19   if not test then
 | 
| 
jbe@352
 | 
    20     trace.enter_action{ module = module, action = action }
 | 
| 
jbe@352
 | 
    21   end
 | 
| 
jbe/bsw@0
 | 
    22   local action_status = execute.file_path{
 | 
| 
jbe/bsw@0
 | 
    23     file_path = encode.file_path(
 | 
| 
jbe@206
 | 
    24       WEBMCP_BASE_PATH, 'app', WEBMCP_APP_NAME, module, '_action', action .. '.lua'
 | 
| 
jbe/bsw@0
 | 
    25     ),
 | 
| 
jbe/bsw@0
 | 
    26     id     = args.id,
 | 
| 
jbe@352
 | 
    27     params = args.params,
 | 
| 
jbe@352
 | 
    28     test_existence = test
 | 
| 
jbe/bsw@0
 | 
    29   }
 | 
| 
jbe@352
 | 
    30   if not test then
 | 
| 
jbe@352
 | 
    31     trace.execution_return{ status = action_status }
 | 
| 
jbe@352
 | 
    32   end
 | 
| 
jbe/bsw@0
 | 
    33   return action_status
 | 
| 
jbe/bsw@0
 | 
    34 end
 |