table.foreach is deprecated: now use for + pairs

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
TsT 2012-03-06 00:07:41 +01:00 committed by Uli Schlachter
parent c33aa4a512
commit b5a8936d58
1 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,7 @@ local os = os
local table = table local table = table
local math = math local math = math
local print = print local print = print
local pairs = pairs
local util = require("awful.util") local util = require("awful.util")
--- Completion module. --- Completion module.
@ -172,11 +173,11 @@ function generic(text, cur_pos, ncomp, keywords)
-- Filter out only keywords starting with text -- Filter out only keywords starting with text
local matches = {} local matches = {}
table.foreach(keywords, function(_, x) for _, x in pairs(keywords) do
if x:sub(1 , #text) == text then if x:sub(1, #text) == text then
table.insert(matches, x) table.insert(matches, x)
end end
end) end
-- if there are no matches just leave out with the current text and position -- if there are no matches just leave out with the current text and position
if #matches == 0 then if #matches == 0 then