diff options
Diffstat (limited to 'src/lua_binding_functions.c')
| -rw-r--r-- | src/lua_binding_functions.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/lua_binding_functions.c b/src/lua_binding_functions.c index 3d8f3ee..d2c62b1 100644 --- a/src/lua_binding_functions.c +++ b/src/lua_binding_functions.c @@ -30,7 +30,9 @@ * int lua_mq_unignore_message ************************************************************************/ #include "lua_plugin_manage_internal.h" -#include "session_mq.h" + +#include "stellar/session.h" +#include "stellar/session_mq.h" /* ***** ***** ***** ***** ***** ***** */ int lua_plugin_manage_regist(lua_State *state) @@ -138,6 +140,7 @@ int lua_plugin_manage_regist(lua_State *state) } /* ***** ***** ***** ***** ***** ***** */ +#if 0 int lua_session_get_id(lua_State *state) { /* 参数个数检查 */ @@ -191,57 +194,58 @@ int lua_session_set_id(lua_State *state) return 0; } -int lua_session_get_type(lua_State *state) +int lua_session_set_type(lua_State *state) { /* 参数个数检查 */ - if (lua_gettop(state) != 1) + if (lua_gettop(state) != 2) { lua_settop(state, 0); return 0; } /* 参数类型检查 */ - if (lua_type(state, -1) != LUA_TLIGHTUSERDATA) + if (lua_type(state, -1) != LUA_TNUMBER || lua_type(state, -2) != LUA_TLIGHTUSERDATA) { lua_settop(state, 0); return 0; } + int settype = lua_tointeger(state, -1); + lua_pop(state, 1); struct session *sess = (struct session *)lua_topointer(state, -1); - if (!sess) - { - lua_settop(state, 0); - return 0; - } lua_pop(state, 1); - lua_pushinteger(state, session_get_type(sess)); - return 1; + session_set_type(sess, settype); + return 0; } +#endif -int lua_session_set_type(lua_State *state) +int lua_session_get_type(lua_State *state) { /* 参数个数检查 */ - if (lua_gettop(state) != 2) + if (lua_gettop(state) != 1) { lua_settop(state, 0); return 0; } /* 参数类型检查 */ - if (lua_type(state, -1) != LUA_TNUMBER || lua_type(state, -2) != LUA_TLIGHTUSERDATA) + if (lua_type(state, -1) != LUA_TLIGHTUSERDATA) { lua_settop(state, 0); return 0; } - int settype = lua_tointeger(state, -1); - lua_pop(state, 1); struct session *sess = (struct session *)lua_topointer(state, -1); + if (!sess) + { + lua_settop(state, 0); + return 0; + } lua_pop(state, 1); - session_set_id(sess, settype); - return 0; + lua_pushinteger(state, (int)session_get_type(sess)); + return 1; } /* ***** ***** ***** ***** ***** ***** */ |
