From 340c0f1e742558e2f295b1a8313c5696bc50e711 Mon Sep 17 00:00:00 2001
From: Romain Forlot <romain.forlot@iot.bzh>
Date: Tue, 2 Apr 2019 14:41:22 +0200
Subject: Use the action API rather than the source one

Action's API member is the API calling the LUA function. It is better to use
it instead of the source one which is user set up and may be non valid.

Change-Id: Ia4638eb378ef7275bac016afaabef19a5eac2b9a
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
---
 ctl-lib/ctl-lua.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'ctl-lib')

diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c
index e290ec1..04b4ce9 100644
--- a/ctl-lib/ctl-lua.c
+++ b/ctl-lib/ctl-lua.c
@@ -790,7 +790,7 @@ int LuaCallFunc(CtlSourceT *source, CtlActionT *action, json_object *queryJ) {
     // effectively exec LUA script code
     err = lua_pcall(luaState, count, 1, 0);
     if (err) {
-        AFB_API_ERROR(source->api, "LuaCallFunc: Fail calling %s error=%s", func, lua_tostring(luaState, -1));
+        AFB_API_ERROR(action->api, "LuaCallFunc: Fail calling %s error=%s", func, lua_tostring(luaState, -1));
         return -1;
     }
 
-- 
cgit