Table of Contents:
  1. lua的table内置库
    1. concat
      1. sort
        1. insert
          1. foreach
            1. foreachi
              1. remove
                1. setn

                lua的table内置库

                Reading Time:The full text has 140 words, estimated reading time: 1 minutes
                Creation Date:2022-04-14
                Article Tags:
                Previous Article:lua的math内置库
                Next Article:lua的string内置库
                 
                BEGIN

                concat

                table.concat(table [, sep [, i [, j]]])

                拼接table中的元素生成字符串,其中入参sep为拼接符,i为起点坐标,j为终点坐标

                sort

                table.sort(table [, comp])

                table值排序,comp为对比方法

                insert

                table.insert(table, [pos,] value)

                table中插入值,pos为下标

                foreach

                table.foreach(table, f)

                循环table中的键值对作为函数入参,已在5.1版本弃用,使用pairs()替代

                foreachi

                table.foreachi(table, f)

                同foreach已在5.1版本弃用,使用ipairs()替代

                remove

                table.remove(table [, pos])

                删除table中指定下标的值,当不指定pos下标值则删除末尾

                setn

                table.setn(table, n)

                设置table长度

                FINISH
                Previous Article:lua的math内置库
                Next Article:lua的string内置库

                Random Articles
                Life Countdown
                default