目錄:
  1. lua的table内置库
    1. concat
      1. sort
        1. insert
          1. foreach
            1. foreachi
              1. remove
                1. setn

                lua的table内置库

                閱讀時間:全文 140 字,預估用時 1 分鐘
                創作日期:2022-04-14
                文章標籤:
                上篇文章:lua的math内置库
                下篇文章: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
                上篇文章:lua的math内置库
                下篇文章:lua的string内置库

                隨機文章
                人生倒計時
                default