用Lua代替%运算符 [英] Lua replacement for the % operator
本文介绍了用Lua代替%运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检查一个数字是否可以被另一个数字整除:
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
这应该可以正常工作,但是如果脚本中有%
,则在我的服务器中使用Lua脚本不会运行...我不知道是什么原因,因此是否有任何替换"为了那个原因?这样我可以检查数字的可分性吗?
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?
谢谢.
推荐答案
查看全文