模组:Table/doc

维基词典,自由的多语言词典

这是Module:Table的文档页面

这个模块提供了处理Lua表格的函数。除了两个辅助函数外,所有函数都将表格当作第一个参数。

Functions by what they do:

  • Create a new table:
    • shallowClone, shallowcopy, deepcopy, removeDuplicates, numKeys, affixNums, numData, compressSparseArray, keysToList, reverse, invert, listToSet
  • Return information about the table:
    • size, length, contains, keyFor, isArray
  • Generate an iterator:
    • sparseIpairs, sortedPairs, reverseIpairs
  • Other:
    • sparseConcat, serialCommaJoin, reverseConcat

These functions treat the table as an array or operate on the values in the array portion of the table (values indexed by consecutive integers starting at 1):

  • removeDuplicates, length, contains, serialCommaJoin, reverseIpairs, reverse, invert, listToSet, isArray

The original version was a copy of Module:TableTools on Wikipedia via Module:TableTools on Commons, but new functions have been added since then.