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 » Scripters
Home Search
 

A Question Regarding Tables

Previous Thread :: Next Thread 
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
16 Oct 2016 08:54 PM
I have a fair knowledge on the understanding of tables, but however I have a question. It's regarding to dictionaries. So let's say that I iterate the table/dictionary with the for _,v in pairs loop. Can I count the amount of arrays in a dictionary?

I haven't really practiced that much with the use of dictionaries which I ought to.


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
16 Oct 2016 08:56 PM
not directly. since dictionaries are indexed by keys, there is no length to them. You will have to manually add the keys.

local tab = {
yo = 1,
hi = 2,
}

DictionaryLength = function(tab)
local i = 0
for key in next, tab dp
i = i + 1
end
return i
end

print(DictionaryLength(tab)) >> 2


Report Abuse
liteImpulse is not online. liteImpulse
Joined: 05 Sep 2016
Total Posts: 251
16 Oct 2016 08:57 PM
Oh I see. That was helpful, thank you!


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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