Forum
![>](img/i_next.png)
![>](img/icons/cs2d.png)
![>](img/i_next.png)
![>](img/i_next.png)
Integer and not integer
6 replies![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
function check(number) 	if number%1 == 0 then 		return true 	else 		number = math.floor(number) --or math.ceil I guess 		return number 	end end
This ._. ?
you can try checking if it's above or equal to x.5 then math.ceil and if it isn't, then math.floor.
edited 1×, last 05.03.14 02:01:00 pm
![](img/smiles/bigsmile.gif)
But, how do i check that ?
Thanks everyone !
![](img/smiles/bigsmile.gif)
edited 1×, last 05.03.14 02:38:25 pm
Maybe this might help you?
![user](img/i_friend.png)
@
![user](img/i_friend.png)
1
2
3
4
5
6
7
2
3
4
5
6
7
function check(x) 	if math.floor(x)==x then 		return true 	else 		return math.floor(x+0.5) 	end end
![•](img/dot.gif)
![•](img/dot.gif)
![•](img/dot.gif)
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
check = function(n) 	local fl = math.floor(n) 	if fl == n then 		return true 	else 		return ((n - fl >= 0.5) and math.ceil(n) or fl) 	end end
1
2
3
4
2
3
4
function isInteger(n) 	if n==math.floor(n) then return true end 	return math.floor(n+0.5) end
![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)