skittles sour Posted May 20, 2021 Share Posted May 20, 2021 Hello, so looking through the prefab files, when there is a task that needs to be paused, frequently I see both task:Cancel() and task = nil. Is the reassignment of the task to nil redundant here? What does it serve exactly? Link to comment https://forums.kleientertainment.com/forums/topic/130139-taskcancel-and-task-nil/ Share on other sites More sharing options...
CarlZalph Posted May 20, 2021 Share Posted May 20, 2021 It's not redundant, it lets other parts of code know that the timer is no longer active and stored. "if task then `task is valid` end" Also lets you metatable hook the timer object being created as a side effect. 2 Link to comment https://forums.kleientertainment.com/forums/topic/130139-taskcancel-and-task-nil/#findComment-1462090 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now