diff options
-rw-r--r-- | lua/lua-plugin.h | 30 | ||||
-rw-r--r-- | lua/test-lua-plugin.c | 1 |
2 files changed, 30 insertions, 1 deletions
diff --git a/lua/lua-plugin.h b/lua/lua-plugin.h index b2fe8e5..2ffdeed 100644 --- a/lua/lua-plugin.h +++ b/lua/lua-plugin.h @@ -5,6 +5,34 @@ int lua_plugin_init(lua_State * L); int lua_plugin_fini(lua_State * L); #define LUA_IMELIBNAME "ime" -LUALIB_API int (luaopen_ime) (lua_State *L); +LUALIB_API int (luaopen_ime) (lua_State * L); + +typedef struct{ + const char * command_name; + const char * lua_function_name; + const char * description; + const char * leading; /* optional, default "digit". */ + const char * help; /* optional. */ +} lua_command_t; + +/** + * retrieve all available lua plugin commands. + * return array of command informations of type lua_command_t. + */ +GArray * lua_plugin_ime_get_available_commands(lua_State * L); + +/** + * retval int: only support string or string array. + */ +int lua_plugin_ime_call(lua_State * L, const lua_command_t * command, const char * argument /*optional, maybe NULL.*/); + +/** + * retrieve the retval string value. (value has been copied.) + */ +const char * lua_plugin_ime_get_retval(lua_State * L); +/** + * retrieve the array of string values. (string values have been copied.) + */ +GArray * lua_plugin_ime_get_retvals(lua_State * L); #endif diff --git a/lua/test-lua-plugin.c b/lua/test-lua-plugin.c index 5dec834..c2de597 100644 --- a/lua/test-lua-plugin.c +++ b/lua/test-lua-plugin.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <glib.h> #include "lua.h" #include "lualib.h" |