awful.util: add table.concat()

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-04-15 10:46:34 +02:00
parent d0b7cc9c97
commit 0215aa5b42
1 changed files with 20 additions and 0 deletions

View File

@ -14,6 +14,7 @@ local debug = debug
local print = print
local type = type
local rtable = table
local ipairs = ipairs
local capi =
{
awesome = awesome,
@ -23,6 +24,8 @@ local capi =
--- Utility module for awful
module("awful.util")
table = {}
function deprecate(see)
io.stderr:write("W: awful: function is deprecated")
if see then
@ -214,4 +217,21 @@ function subsets(set)
return ret
end
--- Concat all tables given as parameters.
-- This will iterate both tables and insert value from 1 to N.
-- Non integer keys are ignored.
-- @param t1 First table.
-- @param t2 Second table.
-- @return A new table with t1 and t2 concatened.
function table.concat(t1, t2)
local ret = {}
for k, v in ipairs(t1) do
ret[#ret + 1] = v
end
for k, v in ipairs(t2) do
ret[#ret + 1] = v
end
return ret
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80