aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-lua.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-03 16:49:50 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:55 +0100
commit86ef7555fa0385f01ed5d7fb3e056c3b6893d70d (patch)
tree6793f64d4ea867bf5c64a3eeba0bf10634ff3a16 /ctl-lib/ctl-lua.c
parent616b975b75f13ff60818c915d8691118f3157d9e (diff)
New function returning the binding root directory
Change-Id: If4d8416c87c668ebc55d3866ccd038c652317b43 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-lua.c')
-rw-r--r--ctl-lib/ctl-lua.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c
index 9e4f791..9194d75 100644
--- a/ctl-lib/ctl-lua.c
+++ b/ctl-lib/ctl-lua.c
@@ -670,6 +670,20 @@ static int LuaAfbGetUid(lua_State* luaState) {
return 1; // return argument
}
+static int LuaAfbGetRootDir(lua_State* luaState) {
+
+ CtlSourceT *source = LuaSourcePop(luaState, LUA_FIRST_ARG);
+ if (!source) {
+ lua_pushliteral(luaState, "LuaAfbEventSubscribe-Fail Invalid request handle");
+ return 0;
+ }
+
+ // extract and return afbSource from timer handle
+ lua_pushstring(luaState, GetBindingDirPath(source->api));
+
+ return 1; // return argument
+}
+
static int LuaAfbGetStatus(lua_State* luaState) {
CtlSourceT *source = LuaSourcePop(luaState, LUA_FIRST_ARG);
@@ -1274,6 +1288,7 @@ static const luaL_Reg afbFunction[] = {
{"evtmake", LuaAfbEventMake},
{"evtpush", LuaAfbEventPush},
{"getuid", LuaAfbGetUid},
+ {"getrootdir", LuaAfbGetRootDir},
{"status", LuaAfbGetStatus},
{"context", LuaClientCtx},
{"lockwait", LuaLockWait},