Skip to content

LuaMultiReturn returns all values even when indexed with [0] #1411

@Cheatoid

Description

@Cheatoid

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions