I want to check, if a number is divisible by another number:
for i = 1, 100 do
if i % 2 == 0 then
print( i .. " is divisible.")
end
end
This should work without any problems, but with the Lua in my server the script doesn't run if there is a %
in the script... I dont know whats the reason, so is there any "replacement" for that? So I could check the number divsibility?
Thank you.
Use math.fmod(x,y)
which does what you want:
Returns the remainder of the division of x by y that rounds the quotient towards zero.