diff options
| author | Peng Wu <alexepico@gmail.com> | 2018-06-07 15:07:31 +0800 |
|---|---|---|
| committer | Peng Wu <alexepico@gmail.com> | 2018-06-07 15:07:31 +0800 |
| commit | 24cd9ed4274d9a7a7a25862537d08b8e83be30bf (patch) | |
| tree | 3467b0f99a3b6d497bbd5752633426709eacf090 /lua/lua-plugin.c | |
| parent | c2e1912687bf89c6b0d8bb9529998f775e95ea51 (diff) | |
| download | ibus-libpinyin-24cd9ed4274d9a7a7a25862537d08b8e83be30bf.tar.gz ibus-libpinyin-24cd9ed4274d9a7a7a25862537d08b8e83be30bf.tar.xz ibus-libpinyin-24cd9ed4274d9a7a7a25862537d08b8e83be30bf.zip | |
update lua-plugin.h
Diffstat (limited to 'lua/lua-plugin.c')
| -rw-r--r-- | lua/lua-plugin.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lua/lua-plugin.c b/lua/lua-plugin.c index 89941e7..cb48f9b 100644 --- a/lua/lua-plugin.c +++ b/lua/lua-plugin.c @@ -260,6 +260,23 @@ static const lua_command_candidate_t * ibus_engine_plugin_get_candidate(lua_Stat } /** + * retrieve the string value. (value has been copied.) + */ +const char * ibus_engine_plugin_get_result_string(IBusEnginePlugin * plugin){ + IBusEnginePluginPrivate * priv = IBUS_ENGINE_PLUGIN_GET_PRIVATE(plugin); + const char * result = NULL; int type; + lua_State * L = priv->L; + + type = lua_type(L ,-1); + if ( LUA_TNUMBER == type || LUA_TBOOLEAN == type || LUA_TSTRING == type) { + result = g_strdup(lua_tostring(L, -1)); + lua_pop(L, 1); + } + + return (const char *)result; +} + +/** * retrieve the retval string value. (value has been copied.) */ const lua_command_candidate_t * ibus_engine_plugin_get_retval(IBusEnginePlugin * plugin){ |
