X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cf108868b4eeed4d0d9d343bc68557d7814e18c0..acac7aa68c0c8fb3a534e04fecf11f6e143678c5:/src/bindings/lua/lua_private.h?ds=sidebyside diff --git a/src/bindings/lua/lua_private.h b/src/bindings/lua/lua_private.h index 63472f0013..dfeccf11e1 100644 --- a/src/bindings/lua/lua_private.h +++ b/src/bindings/lua/lua_private.h @@ -23,4 +23,12 @@ const char* sglua_get_msg_error(msg_error_t err); } +#define lua_ensure(...) \ + _XBT_IF_ONE_ARG(_lua_ensure_ARG1, _lua_ensure_ARGN, __VA_ARGS__)(__VA_ARGS__) +#define _lua_ensure_ARG1(cond) \ + _lua_ensure_ARGN(cond, "Assertion %s failed", #cond) +#define _lua_ensure_ARGN(cond, ...) \ + do { if (!(cond)) { luaL_error(L, __VA_ARGS__); return -1;} } while (0) + + #endif /* LUA_PRIVATE_H */