Anaminus / roblox-bug-tracker

Formerly an unofficial bug tracker for Roblox.
31 stars 24 forks source link

Check arguments when calling Spawn and Delay #764

Open cntkillme opened 8 years ago

cntkillme commented 8 years ago

It doesn't seem that (at least) the first argument is checked when calling. This causes a vague error message when the first argument (supposed to be a function) is called later from the thread scheduler (you get no stack trace or any other information).

Reproduction: delay(1, 0.5); -- >after half a second, you get the error: attempt to call a number value

SNCPlay42 commented 8 years ago

Very similar in nature to #137 which was for events.

The only real argument towards permitting this is values with a __call metamethod:

> delay(0, setmetatable({}, {__call = function() print("This works") end}))
This works

Any modification to check types would likely reject this.

Probably better to check it at call time anyway for ease of debugging, but you know, workflows.

cntkillme commented 8 years ago

Oh wow, didn't see that issue. Yeah hadn't actually thought of people doing that. Thank you

SNCPlay42 commented 8 years ago

I'd leave the issue open personally, #137 got fixed, for better or worse, and it probably should be made consistent.