【问题标题】:Strange "attempt to perform arithmetic on a function value" error in lualua中奇怪的“尝试对函数值执行算术”错误
【发布时间】:2019-04-29 19:08:41
【问题描述】:

我正在用普通 Lua 编写一个 BASIC 解释器,在编写我的 SLEEP X 函数时遇到了困难。

我不是专家,但这里看起来没什么问题...

function s(time)
local time=tonumber(time)
if useSleep then sleep(time) elseif useWait then wait(time) else
--oh no
--we will try our best
local ct=os.time+time
repeat until(os.time>=ct)
end end
--test
s(5)

【问题讨论】:

    标签: lua


    【解决方案1】:

    您需要致电os.time,使用os.time()

    os.time 是函数。

    os.time() 是它的结果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-06
      • 1970-01-01
      • 2012-01-27
      • 1970-01-01
      • 2014-02-17
      • 2020-08-22
      • 2015-11-07
      • 1970-01-01
      相关资源
      最近更新 更多