Files
dotfiles/nvim/mason/packages/lua-language-server/libexec/meta/LuaJIT zh-cn utf8/table/clear.lua
2025-09-28 11:39:12 +02:00

18 lines
732 B
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---@meta table.clear
---@version JIT
---
---清除表中所有的键值对,但是保留已经分配的数组或哈希的大小。当需要清除从多个位置链接的表和/或回收表供同一上下文使用时,这将十分有用。这避免了管理反向链接,节省了分配和增量数组或哈希部分增长的开销。在使用前需要先引入。
---```lua
--- require("table.clear").
---```
---请注意此功能用于非常特殊的情况。在大多数情况下最好用新表替换通常是单个链接GC 完成回收工作。
---
---
---[查看文档](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.clear"])
---
---@param tab table
local function clear(tab) end
return clear