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

how to check a table's contents one by one?

Asked by 9 years ago

So, I have a table called "competitors" with a list of player's Name. What I want to know is, how would you check the table's contents one by one because I want to find the players who are in the table in Workspace by doing

game.Workspace:FindFirstChild("competitors")

or something

0
Are the values in the table PlayerObjects or strings? https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online TheDeadlyPanther 2460 — 9y
0
strings pootlavato567 0 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

try something like this its a string to table and table to string converter kinda system

players=""
for i,v in pairs(game.Players:GetPlayers()) do
    players=players.."{"..v.Name.."}"
end
function parse(str,pre,suf)
    local strings={}    
for i in string.gmatch(str,pre..".-"..suf) do 
  local i2=0
    i2=i2+1
    table.insert(strings,string.sub(i,2,string.len(i)-1))

    end
return strings
end
for i,v in pairs(parse(players,"{","}")) do
    print(v)
end
Ad

Answer this question