Bean666 Posted July 6, 2016 Share Posted July 6, 2016 how do i use getTeamFromName using tables thanks in advance local teams = { "Military", "FIB", "SWAT" } local theTeam = getTeamFromName("??") Link to comment
Walid Posted July 6, 2016 Share Posted July 6, 2016 check this: --Example 1: local teams = { ["Team1"] = teamName1; ["Team2"] = teamName2; } -- then you can use this to get the team from name local theTeam = getTeamFromName(teams["Team1"]) -- Example 2 local teams = { team1 = teamName1; team2 = teamName2; } -- and you can use this to get the team from name local theTeam = getTeamFromName(teams.team1) Link to comment
Captain Cody Posted July 6, 2016 Share Posted July 6, 2016 Or you can use this teama = teams[1] --- Switch out 1 with the number you want as long as its in range in the table. But after looking at what you want, other guys solution would work better I believe. Link to comment
Bean666 Posted July 6, 2016 Author Share Posted July 6, 2016 actually what i want is not like this what i wanted is all the stuff on the table not 1 2 3 stuff or maybe i just missed something , but yeah ill try something / learn on my own Link to comment
Captain Cody Posted July 6, 2016 Share Posted July 6, 2016 Teamsb = {} Teams = { "Military", "FIB", "SWAT" } for i,v in pairs (Teams) do Teamsb[v] = getTeamFromName[v] end This what you looking for? Link to comment
Bean666 Posted July 6, 2016 Author Share Posted July 6, 2016 aye aye thanks. what does the Teamsb = {} do? Link to comment
Captain Cody Posted July 6, 2016 Share Posted July 6, 2016 That sets up the table. Table = {} -- Creates an empty table Table[1] = "Test" -- Assigns a value to the table function test () local tablea = Table[2] -- Turns value #2 into a local table local tablea[1] = "test" -- Assigns a value to the table local tableb = tablea[1] -- Deeper table. --- And so on Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now