Spawn function in strict mode shows "Argument count mismatch" warning

Simply write this code in the script editor:

--!strict
spawn(function()
end)

This will cause the following warning to show:
W000: Argument count mismatch. Function takes 1 arguments but you passed 0

why no load:(

This started happening January 20, 2020, and only happens with type checking & strict mode enabled. It happens every time.

It seems spawn is the only function affected by this.

This is a known bug. We’re on it. :slight_smile:

The bug is that spawn() expects its function argument to return exactly 1 value. It’s doing the wrong thing in the case where the function returns 0 values. (or 2 or more)

If you want a short-term workaround, you can instead write

spawn(function()
    print('Hello World!')
    return nil
end)
1 Like