From a51a298b5a7e5067873b7854687b3ead6d13d8b7 Mon Sep 17 00:00:00 2001 From: “pengxuanzheng” Date: Tue, 19 Jul 2022 07:00:35 +0000 Subject: ✨ feat(TSG-11154): 增加remove命令,可以用来移除特定的lua API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tsg_lua_func.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/tsg_lua_func.cpp') 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 -- cgit v1.2.3