1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 20:36:38 +02:00

lua: use lua_pushinteger for int values in lua 5.3

This commit is contained in:
tomoe-mami
2016-11-01 14:18:47 +01:00
committed by Sébastien Helleu
parent dc3cdcbb7f
commit 899b397f3f
2 changed files with 17 additions and 0 deletions
+9
View File
@@ -82,12 +82,21 @@
if (__string) \
free (__string); \
return 1
#if LUA_VERSION_NUM >= 503
#define API_RETURN_INT(__int) \
lua_pushinteger (L, __int); \
return 1
#define API_RETURN_LONG(__long) \
lua_pushinteger (L, __long); \
return 1
#else
#define API_RETURN_INT(__int) \
lua_pushnumber (L, __int); \
return 1
#define API_RETURN_LONG(__long) \
lua_pushnumber (L, __long); \
return 1
#endif /* LUA_VERSION_NUM >= 503 */
/*
+8
View File
@@ -188,7 +188,11 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
lua_pushstring (lua_current_interpreter, (char *)argv[i]);
break;
case 'i': /* integer */
#if LUA_VERSION_NUM >= 503
lua_pushinteger (lua_current_interpreter, *((int *)argv[i]));
#else
lua_pushnumber (lua_current_interpreter, *((int *)argv[i]));
#endif /* LUA_VERSION_NUM >= 503 */
break;
case 'h': /* hash */
weechat_lua_pushhashtable (lua_current_interpreter,
@@ -267,7 +271,11 @@ weechat_lua_add_constant (lua_State *L, struct t_lua_const *ptr_const)
if (ptr_const->str_value)
lua_pushstring (L, ptr_const->str_value);
else
#if LUA_VERSION_NUM >= 503
lua_pushinteger (L, ptr_const->int_value);
#else
lua_pushnumber (L, ptr_const->int_value);
#endif /* LUA_VERSION_NUM >= 503 */
lua_settable(L, -3);
}