How to pause/resume the Lua script scheduler?

How to pause/resume the Lua script scheduler?


I was stuck by a problem about Scheduler in Lua.
Cocos2d-x has provided a method for Lua users to use the scheduler, like this:

local entry = cc.Director:getInstance():getScheduler():scheduleScriptFunc(
    1, true    -- this will be paused

The document says:

If paused is true, then it won't be called until it is resumed.

Now since it’s paused, I’d like to know how I can resume this entry. I tried self:pause(), but it seems to be not working.

PS: I know about Node::scheduleUpdateWithPriorityLua, but I couldn’t pause it either.
Can anyone help?

I found a solution: use object’s scheduler. In other words

local scheduler = self:getgetScheduler()

instead of

local scheduler = cc.Director:getInstance():getScheduler()

And use self:resume() and self:pause(), but keep in mind: it will be auto-paused on exit and auto-resumed on enterance (it will be paused if current scene don’t contain it)