13#ifndef FC__LUASCRIPT_H
14#define FC__LUASCRIPT_H
41 const char *format, ...)
70 const char *format, ...)
103#define LUASCRIPT_ASSERT_CAT(str1, str2) str1 ## str2
107#define LUASCRIPT_ASSERT(L, check, ...) \
109 luascript_error(L, "in %s() [%s::%d]: the assertion '%s' failed.", \
110 __FUNCTION__, __FILE__, __FC_LINE__, #check); \
111 return LUASCRIPT_ASSERT_CAT(, __VA_ARGS__); \
114#define LUASCRIPT_ASSERT(check, ...)
117#define LUASCRIPT_CHECK_STATE(L, ...) \
119 log_error("No lua state available"); \
120 return LUASCRIPT_ASSERT_CAT(, __VA_ARGS__); \
124#define LUASCRIPT_CHECK(L, check, msg, ...) \
126 luascript_error(L, msg); \
127 return LUASCRIPT_ASSERT_CAT(, __VA_ARGS__); \
131#define LUASCRIPT_CHECK_ARG(L, check, narg, msg, ...) \
133 luascript_arg_error(L, narg, msg); \
134 return LUASCRIPT_ASSERT_CAT(, __VA_ARGS__); \
138#define LUASCRIPT_CHECK_ARG_NIL(L, value, narg, type, ...) \
139 if ((value) == NULL) { \
140 luascript_arg_error(L, narg, "got 'nil', '" #type "' expected"); \
141 return LUASCRIPT_ASSERT_CAT(, __VA_ARGS__); \
146#define LUASCRIPT_CHECK_SELF(L, value, ...) \
147 if ((value) == NULL) { \
148 luascript_arg_error(L, 2, "got 'nil' for self"); \
149 return LUASCRIPT_ASSERT_CAT(, __VA_ARGS__); \
void luascript_pop_returns(struct fc_lua *fcl, const char *func_name, int nreturns, enum api_types *preturn_types, va_list args)
void luascript_push_args(struct fc_lua *fcl, int nargs, enum api_types *parg_types, va_list args)
void luascript_log(struct fc_lua *fcl, enum log_level level, const char *format,...) fc__attribute((__format__(__printf__
bool luascript_check_function(struct fc_lua *fcl, const char *funcname)
int luascript_error(lua_State *L, const char *format,...) fc__attribute((__format__(__printf__
int int luascript_error_vargs(lua_State *L, const char *format, va_list vargs)
int luascript_arg_error(lua_State *L, int narg, const char *msg)
bool luascript_callback_invoke(struct fc_lua *fcl, const char *callback_name, int nargs, enum api_types *parg_types, va_list args)
void luascript_remove_exported_object(struct fc_lua *fcl, void *object)
int luascript_do_string(struct fc_lua *fcl, const char *str, const char *name)
int luascript_do_file(struct fc_lua *fcl, const char *filename)
void(* luascript_log_func_t)(struct fc_lua *fcl, enum log_level level, const char *format,...) fc__attribute((__format__(__printf__
void luascript_vars_load(struct fc_lua *fcl, struct section_file *file, const char *section)
void void luascript_log_vargs(struct fc_lua *fcl, enum log_level level, const char *format, va_list args)
const Direction * luascript_dir(enum direction8)
struct fc_lua * luascript_new(luascript_log_func_t outputfct, bool secured_environment)
void luascript_vars_save(struct fc_lua *fcl, struct section_file *file, const char *section)
struct fc_lua * luascript_get_fcl(lua_State *L)
int luascript_call(struct fc_lua *fcl, int narg, int nret, const char *code)
void luascript_destroy(struct fc_lua *fcl)
enum direction8 Direction
struct setting_list * level[OLEVELS_NUM]
struct connection * caller
struct luascript_signal_hash * signals
struct luascript_signal_name_list * signal_names
luascript_log_func_t output_fct
struct luascript_func_hash * funcs