diff options
Diffstat (limited to 'locale/zh-cn/meta.lua')
-rw-r--r-- | locale/zh-cn/meta.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/locale/zh-cn/meta.lua b/locale/zh-cn/meta.lua index a192ff72..a8b69959 100644 --- a/locale/zh-cn/meta.lua +++ b/locale/zh-cn/meta.lua @@ -734,6 +734,19 @@ table.foreachi = '遍历数组中的每一个元素,并以索引号index和value执行回调函数。如果回调函数返回一个非nil值则循环终止,并且返回这个值。该函数等同ipair(list),比ipair(list)更慢。不推荐使用' table.getn = '返回表的长度。该函数等价于#list。' +table.new = -- TODO: need translate! +[[This creates a pre-sized table, just like the C API equivalent `lua_createtable()`. This is useful for big tables if the final table size is known and automatic table resizing is too expensive. `narray` parameter specifies the number of array-like items, and `nhash` parameter specifies the number of hash-like items. The function needs to be required before use. +```lua + require("table.new") +``` +]] +table.clear = -- TODO: need translate! +[[This clears all keys and values from a table, but preserves the allocated array/hash sizes. This is useful when a table, which is linked from multiple places, needs to be cleared and/or when recycling a table for use by the same context. This avoids managing backlinks, saves an allocation and the overhead of incremental array/hash part growth. The function needs to be required before use. +```lua + require("table.clear"). +``` +Please note this function is meant for very specific situations. In most cases it's better to replace the (usually single) link with a new table and let the GC do its work. +]] utf8 = '' |