menu
Roblox Forum Archive
Home
User Search
Forums
Donate
search
settings
Home
User Search
Forums
Donate
launch
Go to User Dashboard
Forums
Scripting Helpers
Comparing Names and arrays
chevron_left
chevron_left
chevron_left
of
1
chevron_right
chevron_right
chevron_right
Comparing Names and arrays
Seranok
Join Date: 2009-12-12
Post Count: 11083
#36839252
Thursday, November 11, 2010 3:13 PM GMT
Model = game.Workspace.LOL2 Map = {LOL, LOL2} for i = 1, #Map do if Model.Name == Map[i] then print("woot") end end Why doesn't this script work?
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
Blaboblox
Join Date: 2008-09-12
Post Count: 8945
#36839302
Thursday, November 11, 2010 3:16 PM GMT
Model = game.Workspace.LOL2 Map = {"LOL", "LOL2"} for i = 1, #Map do if Model.Name == Map[i] then print("woot") end end
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
bloob827
Join Date: 2010-08-01
Post Count: 6867
#36839307
Thursday, November 11, 2010 3:16 PM GMT
Model = game.Workspace.LOL2 Map = {game.Workspace.LOL, game.workspace.LOL2 for i,v in pairs(Map) do if v.Name == #Map then print"woot" end end
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
Seranok
Join Date: 2009-12-12
Post Count: 11083
#36839349
Thursday, November 11, 2010 3:18 PM GMT
Can you explain the i,v in pairs? I've never understood that. And do I have to have quotation marks for the strings?
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
bloob827
Join Date: 2010-08-01
Post Count: 6867
#36839353
Thursday, November 11, 2010 3:18 PM GMT
Model1 = game.Workspace.LOL Model = game.Workspace.LOL2 Map = {Model1, Model} for i,v in pairs(Map) do if v.Name == #Map then print"woot" end end
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
bloob827
Join Date: 2010-08-01
Post Count: 6867
#36839377
Thursday, November 11, 2010 3:19 PM GMT
for i,v in pairs(table) do Searches through a table. for i,v in ipairs(table) do searches through a table, but only things without a value.
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
arundel
Join Date: 2008-04-21
Post Count: 5762
#36839390
Thursday, November 11, 2010 3:20 PM GMT
for Index, (obj)Value in pairs (stuff) do.
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
bloob827
Join Date: 2010-08-01
Post Count: 6867
#36839397
Thursday, November 11, 2010 3:20 PM GMT
And yes you need quotes for the strings.
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
chevron_left
chevron_left
chevron_left
of
1
chevron_right
chevron_right
chevron_right