|
| 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 |
|
|
|
| 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 |
|
|
|
| 22 May 2014 06:08 PM |
Sorry I didn't specify that :P
I meant to check for a single entry match. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 22 May 2014 06:09 PM |
| You can iterate through and just check? |
|
|
| Report Abuse |
|
|