My question is quite simple, I was wondering if there is a more efficient way in terms of performance to find whether a value exists inside a specified table without iterating through several keys. With my current knowledge, I would have to do something like this:
local function FindTableValue(Table, Value) for _,v in pairs(Table) do if v == Value then return true end end end
This is generally ok to use in many cases, but when tables start having 50+ values and I am running the finding function every frame, things can get quite slow performance wise. If this question has already been asked, I apologize as I was not able to find something similar here on the website.
As far as i know thats is the quickest way ive done some research and this is what i found