diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-09-20 16:54:14 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:25 +0100 |
commit | 78202d5bd8a8d09a55bb71b9df6d3f54b18184b8 (patch) | |
tree | afbc89a7c104a70e7771939765309e977a5ab96a /controller/ctl-lua.h | |
parent | b68f95e384aa35b54e453b5e7d09dabf8d82340c (diff) |
Make LUA works
- Added LUA library at link
- Make app-template crash build if a checked file fails
- Fix old defined variable CONTROL_LUA_PATH to a default
one in the binding data directory
- Add an example with unit conversion made in LUA
Change-Id: I1b4712bde32a38044ad6b14ebd38b6782fd01fe9
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'controller/ctl-lua.h')
-rw-r--r-- | controller/ctl-lua.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/controller/ctl-lua.h b/controller/ctl-lua.h index 2a85543..2fbebf5 100644 --- a/controller/ctl-lua.h +++ b/controller/ctl-lua.h @@ -25,6 +25,10 @@ #define _GNU_SOURCE #endif +#ifdef __cplusplus +extern "C" { +#endif + // prefix start debug script #ifndef CONTROL_DOSCRIPT_PRE #define CONTROL_DOSCRIPT_PRE "debug" @@ -35,11 +39,6 @@ #define CONTROL_LUA_EVENT "luaevt" #endif -// default use same search path for config.json and script.lua -#ifndef CONTROL_LUA_PATH -#define CONTROL_LUA_PATH CONTROL_CONFIG_PATH -#endif - #define AFB_BINDING_VERSION 2 #include <afb/afb-binding.h> @@ -65,7 +64,7 @@ typedef int (*Lua2cWrapperT) (lua_State* luaState, char *funcname, Lua2cFunction #define CTLP_LUALOAD Lua2cWrapperT Lua2cWrap; #define CTLP_LUA2C(FuncName, label,argsJ, context) static int FuncName(char*label,json_object*argsJ);\ - int lua2c_ ## FuncName(lua_State* luaState){return((*Lua2cWrap)(luaState, MACRO_STR_VALUE(FuncName), FuncName, PLUGIN_NAME));};\ + int lua2c_ ## FuncName(lua_State* luaState){return((*Lua2cWrap)(luaState, MACRO_STR_VALUE(FuncName), FuncName));};\ static int FuncName(char* label, json_object* argsJ, void* context) typedef enum { @@ -74,7 +73,6 @@ typedef enum { LUA_DOSCRIPT, } LuaDoActionT; - int LuaConfigLoad(); int LuaConfigExec(); void LuaL2cNewLib(const char *label, luaL_Reg *l2cFunc, int count); @@ -85,4 +83,8 @@ void ctlapi_lua_dostring (afb_req request); void ctlapi_lua_doscript (afb_req request); +#ifdef __cplusplus +} +#endif + #endif |