Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

is there any way I can refer to an entire table?

Asked by
lytew 99
4 years ago

is there any way I can refer to an entire table? for example: I want to know if in any of the elements of this table, there is the variable "Hello World" without having to refer exactly to its exact position: "if Table [2] ==" Hellow World "then ... is there any way?

0
Do you mean getting every variable in the table? Swaggyguy229 7 — 4y
0
yes, to look for another variable lytew 99 — 4y

1 answer

Log in to vote
1
Answered by
7z99 203 Moderation Voter
4 years ago

You can go through the entire table using a for loop. Judging by your question, you're looking to see if any values are "Hello World".

for i,v in pairs(table) do
    if table[i].Value == "Hello World" then
        --put whatever you want here
        break -- exits the loop, only happens if the condition above is true.
    end
end

I haven't tried it but it should work. Let me know if any errors happen.

0
I also haven't tested it but thanks! lytew 99 — 4y
Ad

Answer this question