awful.util: add table.concat()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
d0b7cc9c97
commit
0215aa5b42
|
@ -14,6 +14,7 @@ local debug = debug
|
||||||
local print = print
|
local print = print
|
||||||
local type = type
|
local type = type
|
||||||
local rtable = table
|
local rtable = table
|
||||||
|
local ipairs = ipairs
|
||||||
local capi =
|
local capi =
|
||||||
{
|
{
|
||||||
awesome = awesome,
|
awesome = awesome,
|
||||||
|
@ -23,6 +24,8 @@ local capi =
|
||||||
--- Utility module for awful
|
--- Utility module for awful
|
||||||
module("awful.util")
|
module("awful.util")
|
||||||
|
|
||||||
|
table = {}
|
||||||
|
|
||||||
function deprecate(see)
|
function deprecate(see)
|
||||||
io.stderr:write("W: awful: function is deprecated")
|
io.stderr:write("W: awful: function is deprecated")
|
||||||
if see then
|
if see then
|
||||||
|
@ -214,4 +217,21 @@ function subsets(set)
|
||||||
return ret
|
return ret
|
||||||
end
|
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
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
Loading…
Reference in New Issue