diff options
Diffstat (limited to 'lua/lua-plugin-init.c')
-rw-r--r-- | lua/lua-plugin-init.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lua/lua-plugin-init.c b/lua/lua-plugin-init.c index e6e86ec..1c122b0 100644 --- a/lua/lua-plugin-init.c +++ b/lua/lua-plugin-init.c @@ -19,6 +19,10 @@ */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <stdio.h> #include <string.h> #include <glib.h> @@ -87,8 +91,7 @@ static int ime_get_last_commit(lua_State* L){ } static int ime_get_version(lua_State* L){ - /* TODO: replace this with C macros. */ - lua_pushliteral(L, "ibus-libpinyin 1.4.0"); + lua_pushliteral(L, PACKAGE_STRING); return 1; } @@ -99,7 +102,7 @@ static int ime_int_to_hex_string(lua_State* L){ luaL_Buffer buf; luaL_buffinit(L, &buf); - gchar * str = g_strdup_printf("%0*x", width, val); + gchar * str = g_strdup_printf("%0*x", (int)width, (int)val); luaL_addstring(&buf, str); g_free(str); @@ -131,7 +134,7 @@ static int ime_join_string(lua_State* L){ for ( i = 1; i < vec_len; ++i){ lua_pushinteger(L, i); lua_gettable(L, 1); - str = luaL_checklstring(L, 3, NULL); + str = luaL_checklstring(L, -1, NULL); luaL_addstring(&buf, str); lua_pop(L, 1); luaL_addstring(&buf, sep); @@ -140,7 +143,7 @@ static int ime_join_string(lua_State* L){ /* add tail of string list */ lua_pushinteger(L, i); lua_gettable(L, 1); - str = luaL_checklstring(L, 3, NULL); + str = luaL_checklstring(L, -1, NULL); luaL_addstring(&buf, str); lua_pop(L, 1); /* remove the args. */ |