is there a way to filter the array by its lua elements? as in the javascript example:
const array = [{
element:"a",
element2:{
example:false
}
},
{
element:"b",
element2:{
example:true
}
}]
let filtered = array.find(itemInArray => itemInArray.element2.example == true) //to get the element
//or
let filtered = array.filter(itemInArray => itemInArray.element2.example == true) // to filter the element
but in lua! like:
local array = {{
["element"] = "a",
["element2"] = {
["example"] = false
}
},
{
["element"] = "b",
["element2"] = {
["example"] = true
}
}}
--in that case, how do I filter the desired result or find it?
in short, is there a lua version of javascript's .find() or .filter() functions?