I would like to know how can a script find if a value exists in a Lua table, something like
luatable = {"abc", "cba", "bab"}
--example: wanted to know if something in workspace with a name of any of those values exists..
How can I do it?
I would like to know how can a script find if a value exists in a Lua table, something like
luatable = {"abc", "cba", "bab"}
--example: wanted to know if something in workspace with a name of any of those values exists..
How can I do it?
You Could Use A For Loop To Search Through The Descendants Of Workspace Or Whatever Your Looking For
Example
local Table = {"abc","bca","cab"}
for i,v in pairs(workspace:GetDescendants()) do -- Will Go Through Everything in the workspace
if Table[v.Name] then -- If the name of the object is in the table
-- Do Rest
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thank you!
np