Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is mod?

2 answers

✓ Accepted answer

Prior Version

Believe it or not, the keyword mod was a function used for calculating modulus in an earlier version of Lua [Lua 4]. Now, however, the current infix notation for modulus is %

I may be wrong but I believe that the syntax highlighting for mod has been kept by mistake. There is also a possibility that the keyword is reserved for a method of a specific instance - but nothing comes to mind.

2 comments

0

mod was a function, not an operator: http://www.lua.org/manual/4.0/manual.html#6.3

0

Edited. Thank You.

Could you be referring to Modulus, often shortened to Mod?

Modulus is the remainder of the division problem with the same numbers. Example:

(Note that % is the symbol used to represent modulus)

-- 10 % 3:
-- 10 / 3 = 3 + R1 (R is remainder)
-- 10 % 3 = 1

This discussion is preserved as it was. New answers, comments, and votes are closed.