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

What does %# do, it just a curiosity question? [closed]

Asked by 5 years ago

I've searched around the internet trying to figure out what %# does in the forms of lua or whatever, however I haven't been able to find a solid answer. What exactly does this do?

0
Personally, I dont know, but perhaps its this? http://wiki.roblox.com/index.php/String_pattern stepatron 103 — 5y
0
The hashtag could also mean the length of something. https://wiki.roblox.com/index.php/Operator stepatron 103 — 5y
0
Sorry for the spam, but could you post the script? stepatron 103 — 5y
0
There isnt a script, its just curiosity. Stephenthefox 94 — 5y
View all comments (2 more)
0
Dunno, if it's something like (5 % #lengthOfString), it means that is finding the remainder of the two values, see the wiki on operators for the #, sorry if I messed up, on mobile stepatron 103 — 5y
0
Yea, it's like the `<--`, it's not a special thing, it's just two different symbols combined, in your case, the modulo and the length operator. theCJarmy7 1293 — 5y

Locked by User#19524

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago

Ok I will go over % the modulus operator then the other one you mentioned. What it does is it returns the remainder of a division problem. Here is an example:

local numberExample = 5 % 2
print(numberExample)

--> output is 1 because 5 /2 = 2 with a remainder of 1

the hashtag is a little more interesting. It will return the length of something. It can return the length of a string and a table and so on. Here is an example:

local tbl = {1, 4, 9, 2}
print(#tbl)
--> output is 4 because the table is four items long.

a really good answer on the modulus can be found here. I hope that I helped you out and have a great day scripting!

Ad