Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
698 views
in Technique[技术] by (71.8m points)

lua - math.pow with Logitech G-Hub

Not to sure how to fix this error. I read there was a change but have no idea how to fix it.

function convert_sens(unconvertedSens) 
    return 0.002 * math.pow(10, unconvertedSens / 50) end

The error code was:

attempt to call a nil value (field 'pow')


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

math.pow is deprecated since Lua 5.3 and even if your framework doesn't provide any math library simply use the exponentiation operator ^.

So instead of math.pow(x, y) simply write x^y


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...