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

How do I select multiple elements in a table?

Asked by 4 years ago

I have a table right here {"String 1", "String 2", "String 3", "String 4", "String 5"}

I want to select element 3 to 5...

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
local number = 0
for _, string in pairs(yourtable) do
    number = number + 1
    if number >= 3 and number <= 5 then
        --is under 3/5 or equal to 3/5
    end
end

or

local number = 0
for _, string in pairs(yourtable) do
    number = number + 1
    if number == 3 and number == 5 then
        --is under 3 or 5
    end
end
Ad

Answer this question