Timer lua中是否有库可以执行“setTimeout”?
我尝试使用RxLua来安排任务。但这导致lua抱怨没有这样的模块Timer lua中是否有库可以执行“setTimeout”?,timer,lua,dependencies,Timer,Lua,Dependencies,我尝试使用RxLua来安排任务。但这导致lua抱怨没有这样的模块 -- minimalexample.lua scheduler = require('rx').TimeoutScheduler.create() scheduler:schedule(function() return, 1000) 结果: lua: ./rx.lua:1913: module 'timer' not found: ... stack traceback: [C]: in function 'require
-- minimalexample.lua
scheduler = require('rx').TimeoutScheduler.create()
scheduler:schedule(function() return, 1000)
结果:
lua: ./rx.lua:1913: module 'timer' not found:
...
stack traceback:
[C]: in function 'require'
./rx.lua:1913: in method 'schedule'
timedtest.lua:7: in main chunk
[C]: in ?
我在网上搜索了一下,结果一无所获。也发布在项目页面上
那里需要什么模块?我做错什么了吗?RxLua模块的维护人员对此反应非常积极:
它取决于标准Lua中不存在的
luvit/timer
Await
或sleep
功能,但是,它有一个模块,您可以使用该模块实现相同的功能
local timer=require('timer')
timer.setTimeout(延迟,回调,…)
——在以毫秒为单位的特定延迟后执行回调一次。varargs在执行时被传递给回调。请向我们提供一个示例,以便我们了解您自己面临的问题。