Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why Do Some For Loops Have a "#"?

Asked by 8 years ago
Edited 8 years ago

Frequently I've seen many For loops have this symbol before something like "game.Lighting:GetChildren()," making it "#game.Lighting:GetChildren()." I was wondering what the "#" has to do with any of this.

1 answer

Log in to vote
1
Answered by 8 years ago

Length

The # operator is the length operator, and gets the length of a table or a string. In most of these loops you're looking at, it's telling it to run the loop as many times as there are entries in the table.

If you're not sure about what I said, you should learn tables.

0
Thanks! sidekick83 80 — 8y
Ad

Answer this question