From 86ef7555fa0385f01ed5d7fb3e056c3b6893d70d Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 3 Aug 2018 16:49:50 +0200 Subject: New function returning the binding root directory Change-Id: If4d8416c87c668ebc55d3866ccd038c652317b43 Signed-off-by: Romain Forlot --- ctl-lib/ctl-lua.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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}, -- cgit 1.2.3-korg