summaryrefslogtreecommitdiff
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-07-13 21:25:51 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-07-13 21:25:51 +0200
commit2682fb450dbb6603ffa30ab8bd9acecde99ddba7 (patch)
tree2c9b0879c9b257c30dbed3ce0da1d51597593637 /src/plugins/lua
parentbf48efffeceeedf705bf91cbb5a79ea18954041c (diff)
downloadweechat-2682fb450dbb6603ffa30ab8bd9acecde99ddba7.zip
lua: fix macros used to return values
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/weechat-lua-api.c62
1 files changed, 40 insertions, 22 deletions
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 1224042de..40eeab49c 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -70,38 +70,56 @@
#define API_STATIC_STRING(__string) \
plugin_script_get_static_string(&lua_data, __string);
#define API_RETURN_OK \
- lua_pushinteger (L, 1); \
- return 1
+ { \
+ lua_pushinteger (L, 1); \
+ return 1; \
+ }
#define API_RETURN_ERROR \
- lua_pushinteger (L, 0); \
- return 1
+ { \
+ lua_pushinteger (L, 0); \
+ return 1; \
+ }
#define API_RETURN_EMPTY \
- lua_pushstring (L, ""); \
- return 0
+ { \
+ lua_pushstring (L, ""); \
+ return 0; \
+ }
#define API_RETURN_STRING(__string) \
- lua_pushstring (L, \
- (__string) ? __string : ""); \
- return 1
+ { \
+ lua_pushstring (L, \
+ (__string) ? __string : ""); \
+ return 1; \
+ }
#define API_RETURN_STRING_FREE(__string) \
- lua_pushstring (L, \
- (__string) ? __string : ""); \
- if (__string) \
- free (__string); \
- return 1
+ { \
+ lua_pushstring (L, \
+ (__string) ? __string : ""); \
+ if (__string) \
+ free (__string); \
+ return 1; \
+ }
#if LUA_VERSION_NUM >= 503
#define API_RETURN_INT(__int) \
- lua_pushinteger (L, __int); \
- return 1
+ { \
+ lua_pushinteger (L, __int); \
+ return 1; \
+ }
#define API_RETURN_LONG(__long) \
- lua_pushinteger (L, __long); \
- return 1
+ { \
+ lua_pushinteger (L, __long); \
+ return 1; \
+ }
#else
#define API_RETURN_INT(__int) \
- lua_pushnumber (L, __int); \
- return 1
+ { \
+ lua_pushnumber (L, __int); \
+ return 1; \
+ }
#define API_RETURN_LONG(__long) \
- lua_pushnumber (L, __long); \
- return 1
+ { \
+ lua_pushnumber (L, __long); \
+ return 1; \
+ }
#endif /* LUA_VERSION_NUM >= 503 */