Find the Number of Indexes in a Dictionary

Hello all. I was attempting to find the number of indexes in a dictionary, but it is not working. Shown below, there is clearly one index that is called “Sleeping” in there, which should show that there is one index.

image

However, when I attempt to print the number of indexes in it, it shows as 0 and not 1. I’m confused on what I’m doing wrong, and any help is greatly appreciated. Thank you.

image

image

You should set the activityTable variable equal to {}, then instead of using activityTable = v, use table.insert(activityTable, v)

1 Like

This worked, thank you so much I appreciate it a lot!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.