I have checked 100k Lua source and see a few errors (sometimes crash).
[...]
I don't know what is the best solution.
Actually I try to replace all '/' with '//' where I want integer division.
That certainly would help, but an essential point is to understand how
you *want* to round these values.
As this point has come up several times, I have a quick quiz for this
list. Without running the code, what are the results of the following
expressions in Lua 5.2?
string.rep("a", 2.7)
string.format("%d", 2.7)
string.rep("a", 2.3)
string.format("%d", 2.3)