I get an error in the script below. I wrote the error code and lines under the script. Please help someone. I have been getting this error for a few days.
These are the lines with errors
[string "LuaVM"]:219: attempt to index a nil value (global 'math')
function convert_sens(unconvertedSens)
return 0.002 * math.pow(10, unconvertedSens / 50)
end
function calc_sens_scale(sensitivity)
return convert_sens(sensitivity)/convert_sens(50)
end
It looks like the Lua interpreter you are using doesn't pre-load
math
library. You can try addinglocal math = require "math"
statement at the beginning of your script, but if this doesn't work, you need to provide more details about your Lua environment. It's possible that access to themath
library is not provided.