fix(doc): gears.table.keys: s/integer keys/integer/ (#3293)

This commit is contained in:
Daniel Hahler 2021-03-22 20:05:17 +01:00 committed by GitHub
parent 80a7d9e3ee
commit dab84c2662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -385,7 +385,7 @@ function util.linecount(text)
return gstring.linecount(text) return gstring.linecount(text)
end end
--- Get a sorted table with all integer keys from a table --- Get a sorted table with all keys from a table.
-- @deprecated util.table.keys -- @deprecated util.table.keys
-- @param t the table for which the keys to get -- @param t the table for which the keys to get
-- @return A table with keys -- @return A table with keys

View File

@ -149,7 +149,7 @@ function gtable.find_first_key(t, matcher, ordered)
end end
--- Get a sorted table with all integer keys from a table. --- Get a sorted table with all keys from a table.
-- --
-- @tparam table t The table for which the keys to get. -- @tparam table t The table for which the keys to get.
-- @treturn table A table with keys. -- @treturn table A table with keys.

View File

@ -2,6 +2,11 @@
local gtable = require("gears.table") local gtable = require("gears.table")
describe("gears.table", function() describe("gears.table", function()
it("table.keys", function()
local t = { 1, a = 2, 3 }
assert.is.same(gtable.keys(t), { 1, 2, "a" })
end)
it("table.keys_filter", function() it("table.keys_filter", function()
local t = { "a", 1, function() end, false} local t = { "a", 1, function() end, false}
assert.is.same(gtable.keys_filter(t, "number", "function"), { 2, 3 }) assert.is.same(gtable.keys_filter(t, "number", "function"), { 2, 3 })