【问题标题】:Expected String, got nil预期的字符串,得到零
【发布时间】:2013-09-18 00:56:09
【问题描述】:

我有以下代码应该只打印一个数字,但它会打印提到的错误:

print(
  math.abs(
    tonumber(TColor, 16) -
    tonumber(FColor, 16)
  ) / 100 * (math.abs(minV - maxV) / 100 * curV) + tonumber(FColor, 16)
)

tostring( math...... )都解决不了

【问题讨论】:

  • 还有TColorFColorminVmaxV的值?

标签: string lua numbers null


【解决方案1】:

发生错误是因为TcolorFcolor 之一是nil。错误是由tonumber() 抛出的。

你可以看到它正在被复制here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-02
    相关资源
    最近更新 更多