Jump to content

teamTable question


Bean666

Recommended Posts

Posted

how do i use getTeamFromName using tables

thanks in advance

local teams = { 
"Military", 
"FIB", 
"SWAT" 
} 
  
local theTeam = getTeamFromName("??") 
  

Posted

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) 

Posted

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.

Posted

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

Posted

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  

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...