Why Does This Increment Function Work Like This?

	function filter(number, increment)
		number = math.ceil(number)
		number = number - (number%increment)
		return number
	end
	Increment = 1

I input the resulting number into this line:

			initialPosVector = Vector3.new(filter(mouse.Hit.X,Increment), filter(mouse.Hit.Y, Increment), filter(mouse.Hit.Z,Increment))

So I found the function above that allows for block movement that responds to mouse input, to be incremented as presented in this video:

What I am looking for is an explanation as to why this function increments the block’s movement.

An example that led to me bringing up this question is this:
If:

number = 3.6
increment = 1

Then the equation would be:

filter(3.6, 1)
       3.6 = math.ceil(3.6)
       4 = 4 - (4/1)   <---this ends up simplifying into   4 = 0   ?_?
       

So the result that is returned is 4 = 0 which is invalid…so I’m not quite sure how this equation increments movement.

I am simply looking for an explanation as why this works.

The = operator has nothing to do with the equals symbol in mathematics. Forget everything you know about equations.

In Lua (and other programming languages) it’s the assignment operator. It assigns to the left-hand-side whatever the right-hand-side is.

E.g. number = math.ceil(number):

number is the LHS, so after the assignment is done, the variable called “number” will have been assigned a new value. That value is whatever the RHS evaluates to. math.ceil(number) calls a function with whatever value happens to be in the variable called number as a parameter. In this case 3.6. It returns that number rounded up to the nearest whole number, and that’s what the entire RHS of the assignment evaluates to. So you cannot say that that line of code means

3.6 = 4

What it actually means is

number = 4