math.pow 与罗技 G-Hub

问题描述

不确定如何修复此错误。我读到有变化,但不知道如何解决

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

错误代码是:

尝试调用一个 nil 值(字段 'pow')

解决方法

math.pow 自 Lua 5.3 起已弃用,即使您的框架不提供任何数学库,也只需使用求幂运算符 ^

所以不要写math.pow(x,y),只需写x^y