lemur icon indicating copy to clipboard operation
lemur copied to clipboard

WIP: Make Script schedule itself to run when parented to a DataModel

Open LPGhatguy opened this issue 6 years ago • 2 comments

This PR takes advantage of the new task scheduler to cause Script (and now LocalScript) objects to schedule themselves to execute when parented to a DataModel.

This logic is right now sort of shaky. I'm not confident that it's correct right now.

Things to do before merge:

  • [x] Port checks to FindFirstAncestorWhichIsA
  • [ ] Verify that this behavior (scripts begin executing when parented) is correct
  • [ ] Figure out whether scripts should push a task into the scheduler or immediately run
  • [ ] Handle error cases correctly:
    • [ ] Parsing errors
    • [ ] Runtime errors before the initial yield, which is the job of the initial caller if not using the task scheduler
  • [ ] Add a method here or in a future PR to explicitly start stepping through all tasks, including scripts

LPGhatguy avatar Jul 08 '18 08:07 LPGhatguy

Coverage Status

Coverage decreased (-0.5%) to 97.22% when pulling 80a5725d78b4bc2f4d6b1e35c808b330f778dc2b on runnable-scripts into 42e609ea4761f648eb1e556274c0030c2a0f50a4 on master.

coveralls avatar Jul 08 '18 08:07 coveralls

Make sure it doesn't run when it shouldn't, by the way (I think only in ReplicatedStorage?). I have plenty of scripts in ReplicatedStorage for placeholder reasons that don't run.

Edit: ServerStorage too.

Kampfkarren avatar Sep 13 '18 21:09 Kampfkarren