diff options
author | Michael Martin <flrgh@protonmail.com> | 2021-12-21 18:10:10 -0800 |
---|---|---|
committer | Michael Martin <flrgh@protonmail.com> | 2021-12-21 18:10:46 -0800 |
commit | 20912f9febfa3c6cea4c11379425971a5b4de7bf (patch) | |
tree | 27dddc5da862748f4958cfb41eb2b369e19c4310 /meta/3rd/OpenResty/library/table.isempty.lua | |
parent | 76c2905a77cf4b1e02e3ca82ee070768d9f7e5e5 (diff) | |
download | lua-language-server-20912f9febfa3c6cea4c11379425971a5b4de7bf.zip |
chore: update table.* and tablepool annotations
Diffstat (limited to 'meta/3rd/OpenResty/library/table.isempty.lua')
-rw-r--r-- | meta/3rd/OpenResty/library/table.isempty.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/meta/3rd/OpenResty/library/table.isempty.lua b/meta/3rd/OpenResty/library/table.isempty.lua new file mode 100644 index 00000000..b1cef6fb --- /dev/null +++ b/meta/3rd/OpenResty/library/table.isempty.lua @@ -0,0 +1,22 @@ +---@meta + +--- Returns `true` when the given Lua table contains neither non-nil array elements nor non-nil key-value pairs, or `false` otherwise. +--- +--- This API can be JIT compiled. +--- Usage: +--- +--- ```lua +--- local isempty = require "table.isempty" +--- +--- print(isempty({})) -- true +--- print(isempty({nil, dog = nil})) -- true +--- print(isempty({"a", "b"})) -- false +--- print(isempty({nil, 3})) -- false +--- print(isempty({cat = 3})) -- false +--- ``` +--- +---@param t table +---@return boolean +local function isempty(t) end + +return isempty |