summaryrefslogtreecommitdiff
path: root/src/lua_binding_functions.c
diff options
context:
space:
mode:
authorniubinghui <[email protected]>2024-08-16 11:50:23 +0800
committerniubinghui <[email protected]>2024-08-16 11:50:23 +0800
commitfce204c8b66bb1084f940f96f4cc5ea505d67a6e (patch)
tree8b17b7ce4f8537e032799d4c28a89251a15c72d3 /src/lua_binding_functions.c
parent3b2baf28064a1fcaa9f193bd9b8f13c9c6f98af2 (diff)
【修改】调整部分头文件路径,替换部分测试函数
Diffstat (limited to 'src/lua_binding_functions.c')
-rw-r--r--src/lua_binding_functions.c40
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;
}
/* ***** ***** ***** ***** ***** ***** */