summaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorPeng Wu <epico@dhcp-65-116.nay.redhat.com>2010-04-07 14:28:53 +0800
committerPeng Wu <alexepico@gmail.com>2010-05-19 10:09:32 +0800
commitd6d3f471888f57f0f5758189da1573cb5d93931f (patch)
tree480e165bdab25abb5176fce86467648e2c414d7f /lua
parent693daa8e9d463ffae61b398243ec97c89fd896eb (diff)
downloadibus-libpinyin-d6d3f471888f57f0f5758189da1573cb5d93931f.tar.gz
ibus-libpinyin-d6d3f471888f57f0f5758189da1573cb5d93931f.tar.xz
ibus-libpinyin-d6d3f471888f57f0f5758189da1573cb5d93931f.zip
add arguments check.
Diffstat (limited to 'lua')
-rw-r--r--lua/lua-plugin-init.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lua/lua-plugin-init.c b/lua/lua-plugin-init.c
index 3131dbc..20fc0b0 100644
--- a/lua/lua-plugin-init.c
+++ b/lua/lua-plugin-init.c
@@ -181,6 +181,23 @@ static int ime_register_command(lua_State * L){
return luaL_error(L, "ime_register_command is called with command_name: %s, whose length is not 2.\n", command_name);
}
+ lua_function_name = luaL_checklstring(L, 2, NULL);
+ lua_getglobal(L, lua_function_name);
+ luaL_checktype(L, -1, LUA_TFUNCTION);
+ lua_pop(L, 1);
+
+ description = luaL_checklstring(L, 3, NULL);
+ if ( !lua_isnil(L, 4)) {
+ leading = luaL_checklstring(L, 4, NULL);
+ }else{
+ leading = "digit";
+ }
+
+ if ( !lua_isnil(L, 5)) {
+ help = luaL_checklstring(L, 5, NULL);
+ }
+
+
return 0;
}