diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-09-26 18:36:47 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:25 +0100 |
commit | c22ad857bcd2f567d22f3239d91fa65720718713 (patch) | |
tree | 165407be42745a190672ff64fe27503074380735 /controller/ctl-lua.h | |
parent | 7f5a4ef3053eaac5c3f936b6294087d3d2b72c38 (diff) |
lua2c completely operationnal
- Retrieve args from lua call correctly
- Correctly push and set function pointer into plugin
symbols
Change-Id: I12d03e1101c458a042887a67a35a08082bd98f4c
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'controller/ctl-lua.h')
-rw-r--r-- | controller/ctl-lua.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/controller/ctl-lua.h b/controller/ctl-lua.h index d41c6a5..0b8de45 100644 --- a/controller/ctl-lua.h +++ b/controller/ctl-lua.h @@ -59,13 +59,13 @@ extern "C" { int LuaLibInit (); -typedef int (*Lua2cFunctionT)(char *funcname, json_object *argsJ); -typedef int (*Lua2cWrapperT) (lua_State* luaState, char *funcname, Lua2cFunctionT callback); +typedef int (*Lua2cFunctionT)(const char *funcname, json_object *argsJ); +typedef int (*Lua2cWrapperT) (lua_State* luaState, const char *funcname, Lua2cFunctionT callback); #define CTLP_LUALOAD Lua2cWrapperT Lua2cWrap; -#define CTLP_LUA2C(FuncName, label,argsJ) static int FuncName(char*label,json_object*argsJ);\ +#define CTLP_LUA2C(FuncName, label, argsJ) static int FuncName(const char*label,json_object*argsJ);\ int lua2c_ ## FuncName(lua_State* luaState){return((*Lua2cWrap)(luaState, MACRO_STR_VALUE(FuncName), FuncName));};\ - static int FuncName(char* label, json_object* argsJ) + static int FuncName(const char* label, json_object* argsJ) typedef enum { LUA_DOCALL, @@ -76,7 +76,7 @@ typedef enum { int LuaConfigLoad(); int LuaConfigExec(); void LuaL2cNewLib(const char *label, luaL_Reg *l2cFunc, int count); -int Lua2cWrapper(lua_State* luaState, char *funcname, Lua2cFunctionT callback); +int Lua2cWrapper(lua_State* luaState, const char *funcname, Lua2cFunctionT callback); int LuaCallFunc (CtlActionT *action, json_object *queryJ) ; void ctlapi_lua_docall (afb_req request); void ctlapi_lua_dostring (afb_req request); |