Awesome-rc is out, so have upgraded and fixed my config accordingly.
Whilst doing so, I needed a lua function to add all the elements of one table to another, similar to python’s list.extend() method. There isn’t one built into lua, so I rolled my own (with some help from #lua).
function joinTables(t1, t2) for k,v in ipairs(t2) do table.insert(t1, v) end return t1 end
et voilĂ
My most recent awesome config can be found, as ever, here
That will have some consequences if the value is a table (insde of table to copy)… As tables are ids, when you change a table from inside of t2 the table in t1 is affected as well :(
:
local t1 = {“epic fail”, 3434, {“LOL”}, “hihihi”}
local t2 = {}
function joinTables(t1, t2)
for k,v in ipairs(t2) do table.insert(t1, v) end return t1
end
joinTables(t2, t1)
t2[3][1] = “HIO”
print(t1[3][1])
Will print “HIO”, even though it was t2 i edited not t1 :)