generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Table matching

Previous Thread :: Next Thread 
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 May 2014 06:05 PM
If I have two tables like this:

local table1 = game.ServerStorage.Maps:GetChildren()
local table2 = game.Workspace:GetChildren()


how can I check for a match between the two tables?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
22 May 2014 06:07 PM
It depends what you mean by a match.
Do you expect every element of the tables to be identical?
Or are you looking for a single element match?
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
22 May 2014 06:08 PM
Sorry I didn't specify that :P

I meant to check for a single entry match.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
22 May 2014 06:09 PM
Easy enough.


function SingleMatch(t1, t2)
for _, v in pairs(t1) do
for _, vv in pairs(t2) do
if v == vv then return true end
end
end
return false
end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 May 2014 06:09 PM
You can iterate through and just check?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image