summaryrefslogtreecommitdiff
path: root/src/tsg_lua_func.cpp
diff options
context:
space:
mode:
author“pengxuanzheng” <[email protected]>2022-07-19 07:00:35 +0000
committer“pengxuanzheng” <[email protected]>2022-07-19 07:36:03 +0000
commita51a298b5a7e5067873b7854687b3ead6d13d8b7 (patch)
tree9c60776971d58be129e53a64131b9095b19ba5ce /src/tsg_lua_func.cpp
parented86120fa4072ce922550ae1304e889e15694ef6 (diff)
✨ feat(TSG-11154): 增加remove命令,可以用来移除特定的lua API
Diffstat (limited to 'src/tsg_lua_func.cpp')
-rw-r--r--src/tsg_lua_func.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tsg_lua_func.cpp b/src/tsg_lua_func.cpp
index 463942c..09d5ba0 100644
--- a/src/tsg_lua_func.cpp
+++ b/src/tsg_lua_func.cpp
@@ -1793,4 +1793,19 @@ int lua_get_error_code(tsg_lua_handle L)
struct lua_private_info_t *lua_info = (struct lua_private_info_t *)lua_getexdata(L);
return lua_info->errcode;
+}
+
+int lua_remove_cmd(tsg_lua_handle L, const char *cmd)
+{
+ if (L == NULL || cmd == NULL)
+ {
+ return ERR_PARAMETER;
+ }
+
+ lua_pushnil(L);
+ lua_setglobal(L, cmd);
+
+ lua_settop(L, 0);
+
+ return 0;
} \ No newline at end of file