roblox-bug-tracker icon indicating copy to clipboard operation
roblox-bug-tracker copied to clipboard

Check arguments when calling Spawn and Delay

Open cntkillme opened this issue 10 years ago • 3 comments

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

cntkillme avatar Mar 13 '16 00:03 cntkillme

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.

SNCPlay42 avatar Mar 15 '16 19:03 SNCPlay42

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

cntkillme avatar Mar 16 '16 06:03 cntkillme

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

SNCPlay42 avatar Mar 16 '16 16:03 SNCPlay42