模組: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.