Array and Table help

Hello,

I have this array :

local testArray = {'Team:Test'}

I was wondering if it was possible to seperate the word test from team, so I can get the value of team.

local str = testArray[1]
local split = str:split(":")
local a = split[1] --Team
local value = split[2] --Test
1 Like

That did not work for some reason.

Does it work if you do

local str = "Team:Test"
local split = string.split(str,":")
local a = split[1] --Team
local value = split[2] --Test
1 Like

Yes that worked thank you so much!

I now have a string with

local testArray = {'Team:Test', 'Team:Arrested'}

how do i make it so i can create mutiple things within the string and it will just look for the thing after team

local ArrestedTeam = testArray[2]

Then you can use string.split()

Dictionaries may be useful:

local testDictionary = {
	Teams = {"Test", "Arrested"}
}

for _, team in pairs(testDictionary.Teams) do 
	print(team)
end
1 Like