LuaMultiReturn returns all values even when indexed with [0] · Issue #1411 · TypeScriptToLua/TypeScriptToLua · GitHub
Skip to content

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

Closed

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.

Activity

  1. changed the title [-]A small bug related to LuaMultiReturn[/-] [+]LuaMultiReturn returns all values even when indexed with [0][/+] on Feb 26, 2023
  2. added a commit that references this issue on Apr 10, 2023
  3. added a commit that references this issue on Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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