Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ clear un-fired resume timers and triggers

clear un-fired resume timers and triggers

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Unia_nt   (17 posts)  Bio
Date Tue 29 Dec 2015 01:46 PM (UTC)

Amended on Wed 30 Dec 2015 05:11 AM (UTC) by Nick Gammon

Message
in some scenario where need a trigger to break the coroutine loop, say search in a maze, find something will stop the search, when this trigger fired, we may need clear all pending triggers and timers created by wait module. So I add below function to do this:


function wait.clearall()
    if not next(threads) then
        return
    end
	for k, _ in pairs(threads) do
		DeleteTimer(k)
		DeleteTrigger(k)
	end
	threads={}
    --print("debug:some coroutine entries have been deleted.")
end


But this will leave some suspend coroutines, not sure if these garbage will be collected by collectgarbage("collect")....
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


7,455 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.