Title: LuaMultiReturn returns all values even when indexed with [0] · Issue #1411 · TypeScriptToLua/TypeScriptToLua · GitHub
Open Graph Title: LuaMultiReturn returns all values even when indexed with [0] · Issue #1411 · TypeScriptToLua/TypeScriptToLua
X Title: LuaMultiReturn returns all values even when indexed with [0] · Issue #1411 · TypeScriptToLua/TypeScriptToLua
Description: 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...
Open Graph Description: 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 mu...
X Description: 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 a...
Opengraph URL: https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1411
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"LuaMultiReturn returns all values even when indexed with [0]","articleBody":"See [Playground sample](https://typescripttolua.github.io/play/#code/GYVwdgxgLglg9mABMOcAUUAWMDOAuRANzhgBMAaRHKAJwOppjAHMBKe2p5xAbwChEgxDQCmUEDSRoGXAHTMcIAEbTalAESz1GgFTrWAbQAMAXVYBuPgF8+oSLASIlAQxoZs+IiQpVaHRizsvgHc-EKIEAjUiAaiigA2UCaIALzBcgrKqjQaWrr6luGi4pLCIglQljZ20PBILgBe7rgExGSUDP5cQTIsvAJCkWDRcSCJqeks8ooqDLnaiOp6hqaFQsUSSKOJVXwADgFQaCjo6tj6FvuHaC5u6rcXlgdMR41o9yANDY98Q9EAjiAAB4TE7vQHAgpAA).\r\n\r\nI expected that `foo` would have transpiled to (notice parentheses):\r\n```lua\r\nfunction foo(str)\r\n return (string.gsub(str, \".\", \"*\"))\r\nend\r\n```\r\nBut, 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.","author":{"url":"https://github.com/Cheatoid","@type":"Person","name":"Cheatoid"},"datePublished":"2023-02-26T14:56:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1411/TypeScriptToLua/issues/1411"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4a64e01d-eb1c-04bd-0853-a0afb839929e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DB0C:34227F:683E5A:92096C:69721AFF |
| html-safe-nonce | 6d26577c305c2e23b3e73cafc1aab67daa01c672d5e8f223679274d63b2b6cbf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjBDOjM0MjI3Rjo2ODNFNUE6OTIwOTZDOjY5NzIxQUZGIiwidmlzaXRvcl9pZCI6IjE4MzUxMjYxNTczOTMxNDA0NzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cc7347b19f746cf2c8566f6bcf0ba37ef8d30a665dfc4a49ea30f8aa29d37def |
| hovercard-subject-tag | issue:1600086471 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TypeScriptToLua/TypeScriptToLua/1411/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5d7f2488b61022c013ed33de905dcef4ffc09d484ae1eaf2b6833878b14ef7fd/TypeScriptToLua/TypeScriptToLua/issues/1411 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5d7f2488b61022c013ed33de905dcef4ffc09d484ae1eaf2b6833878b14ef7fd/TypeScriptToLua/TypeScriptToLua/issues/1411 |
| og:image:alt | 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 mu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Cheatoid |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7aea209b12f15b5742ac38170cf1d21874bf205eb5ad0cac666cd92599fc4cbc |
| turbo-cache-control | no-preview |
| go-import | github.com/TypeScriptToLua/TypeScriptToLua git https://github.com/TypeScriptToLua/TypeScriptToLua.git |
| octolytics-dimension-user_id | 44121206 |
| octolytics-dimension-user_login | TypeScriptToLua |
| octolytics-dimension-repository_id | 115876595 |
| octolytics-dimension-repository_nwo | TypeScriptToLua/TypeScriptToLua |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 115876595 |
| octolytics-dimension-repository_network_root_nwo | TypeScriptToLua/TypeScriptToLua |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3ff289e97142545d3d22ade4ca0ecba5005b7322 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width