dotfiles from arch
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
---@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
|
||||
@@ -0,0 +1,19 @@
|
||||
---@meta table.new
|
||||
|
||||
---@version JIT
|
||||
---
|
||||
---创建一个有初始容量的表,就像 C API 等价于 `lua_createtable()`。对于数据量庞大的表,如果最终的容量是已知的,这将十分有用,因为动态对表进行扩容是十分昂贵的。`narray` 参数指定类数组成员的数量,`nhash` 参数指定类哈希成员的数量。在使用前需要先引入。
|
||||
---
|
||||
---```lua
|
||||
--- require("table.new")
|
||||
---```
|
||||
---
|
||||
---
|
||||
---[查看文档](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.new"])
|
||||
---
|
||||
---@param narray integer
|
||||
---@param nhash integer
|
||||
---@return table
|
||||
local function new(narray, nhash) end
|
||||
|
||||
return new
|
||||
Reference in New Issue
Block a user