i agree with max. however from looking at your code you probably wanna get the number of key/value pairs. you would have to use pairs rather than ipairs. ipairs staps once it sees nil for a key. please fix.
@max96at yay, you are alive, where are you, we miss you on irc D: