of     1   

causlan
#183460140Friday, February 12, 2016 11:10 PM GMT

-- Allow External Access local ProPlayers = {} -- An Array that stores dictionaries of players and their stats Pros = { TestPro1 = { Strength = 50, Speed = 60, Power = 70 }, TestPro2 = { Strength = 70, Speed = 60, Power = 50 } } -- Return Requested Pro Player Stats function ProPlayers.getProPlayer(Pro) print(Pro) for i = 0, #Pros do print(Pros[i]) if tostring(Pros[i]) == Pro then return Pros[i] end end end return ProPlayers -------------------------- Everytime I call the function in a script it returns nil. I tried the argument "TestPlayer2" for (Pro). Any suggestions?
causlan
#183460187Friday, February 12, 2016 11:11 PM GMT

Oh, forgot to mention this is a module script if you can't already tell.
causlan
#183460350Friday, February 12, 2016 11:13 PM GMT

Bump
DrHaximus
#183460607Friday, February 12, 2016 11:16 PM GMT

for i = 0, #Pros do print(Pros[i]) arrays/tables start at 1, not 0
causlan
#183460785Friday, February 12, 2016 11:17 PM GMT

No... ROBLOX arrays are base 0... I just tested it to be sure.
[rfa#hidefromsearch]
#183460786Friday, February 12, 2016 11:17 PM GMT

[rfa#hidefromsearch]
[rfa#hidefromsearch]
#183460859Friday, February 12, 2016 11:18 PM GMT

[rfa#hidefromsearch]
causlan
#183460954Friday, February 12, 2016 11:19 PM GMT

Thank you Froast, I didn't know I could just call it directly.
DrHaximus
#183461228Friday, February 12, 2016 11:22 PM GMT

"No... ROBLOX arrays are base 0... I just tested it to be sure." you're wrong local t = {1,2,3} for i=0,#t do print(t[i]) end => nil => 1 => 2 => 3

    of     1