-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
---@class LinQ: tablelib
---@return LinQ
function LinQ() end
---@generic T, K, V
---@param tbl T|table<K, V>
---@param query? fun(a: V): boolean
---@return T
function table.whereList(tbl, query) end
---@param tbl table
---@return boolean
function table.isEmpty(tbl) end
---@type integer[]|LinQ
local intArray = LinQ {};
for i = 1, 10 do
intArray:insert(math.random(1, 10));
end
---now the array is either empty or filled with ones and\or twos
local list = intArray:whereList(function(element)
return element == 1 or element == 2
end)
---we make sure that there is something in the array and sort it
if not list:isEmpty() then
list:sort(function(a, b) return a > b end)
---after sorting, there should be the maximum number from the array
local firstEl = list[1];
end
Maybe I'm doing something wrong, if that's the case, tell me how it should be.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working