Closed anatolykopyl closed 2 years ago
For Lua 5.1 the use of floats as arguments to math.random
is undefined behaviour.
It looks like in luajit the return value defaults to using the lower bound (in this case 0.8) and in Lua 5.1 PUC (normal non jit lua) it defaults to 0. This is why you don't get an error when you run it on windows or linux, but would if you ran it on the web or on mac.
We have to use Lua 5.1 PUC for the web and mac targets as there is no luajit support. Much of luajit is written in platform specific assembly.
Using one of the three defined behaviours for math.random
fixes this problem. My recommendation for generating a range from 0.8 - 0.9 is:
monkey[n].walkingSound[1]:setPitch(math.random() / 10 + 0.8)
As described in the title, game crashes with the following message:
Referenced line 107:
Built using compatability version.