Concatenation of tables in Lua

后端 未结 9 812
难免孤独
难免孤独 2020-12-09 15:04

ORIGINAL POST

Given that there is no built in function in Lua, I am in search of a function that allows me to append tables together. I have google

9条回答
  •  一个人的身影
    2020-12-09 15:34

    Overcomplicated answers much?

    here is my implementation:

    function TableConcat(t1,t2)
        for i=1,#t2 do
            t1[#t1+i] = t2[i]
        end
        return t1
    end
    

提交回复
热议问题