I'm writing a BASIC interpreter in plain Lua, have hit a wall when writing my SLEEP X function.
I'm no expert but nothing looks wrong here...
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)
Run Code Online (Sandbox Code Playgroud)
You need to call os.time, with os.time().
os.time is the function.
os.time() is its result.
| 归档时间: |
|
| 查看次数: |
39 次 |
| 最近记录: |