See Playground sample.
I expected that foo would have transpiled to (notice parentheses):
function foo(str)
return (string.gsub(str, ".", "*"))
end
But, it clearly doesn't and therefore leads to multiple returns, because string.gsub also returns the amount of replacements as a secondary return value, which invalidates the specified return type : string of the foo... It works fine in case of bar and baz since they make use of a variable.
See Playground sample.
I expected that
foowould have transpiled to (notice parentheses):But, it clearly doesn't and therefore leads to multiple returns, because
string.gsubalso returns the amount of replacements as a secondary return value, which invalidates the specified return type: stringof thefoo... It works fine in case ofbarandbazsince they make use of a variable.