Skip to content

Commit c0de4bf

Browse files
authored
Changed MultiReturn to LuaMultiReturn
TypeScriptToLua/TypeScriptToLua#986
1 parent 8959df2 commit c0de4bf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/advanced/language-extensions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ TypeScriptToLua provides several extensions to the TypeScript language in the fo
1616
}
1717
```
1818

19-
## MultiReturn Type
19+
## LuaMultiReturn Type
2020

21-
This language extension allows typing of Lua functions that return multiple values. For example, consider Lua's `string.find`, it returns two indices: the start of the found substring and the end of the found substring. In TypeScript, functions can only return one value so a special type is needed to indicate to tstl there are multiple return values. This is the `MultiReturn<>` type.
21+
This language extension allows typing of Lua functions that return multiple values. For example, consider Lua's `string.find`, it returns two indices: the start of the found substring and the end of the found substring. In TypeScript, functions can only return one value so a special type is needed to indicate to tstl there are multiple return values. This is the `LuaMultiReturn<>` type.
2222

2323
It allows us to declare `string.find` like this:
2424

2525
```ts title=stringfind.ts
2626
declare namespace string {
27-
export function find(haystack: string, needle: string): MultiReturn<[number, number]>;
27+
export function find(haystack: string, needle: string): LuaMultiReturn<[number, number]>;
2828
}
2929

3030
const [start, end] = string.find("Hello, world!", "world");
@@ -37,15 +37,15 @@ start, ____end = string.find("Hello, world!", "world")
3737
```
3838

3939
:::note
40-
Prefer MultiReturn over the similar [@tupleReturn annotation](./compiler-annotations.md#tuplereturn). MultiReturn can do anything tupleReturn can, with the added benefit of being able to distinguish between actual tuple tables and multiple return values in the type system.
40+
Prefer LuaMultiReturn over the similar [@tupleReturn annotation](./compiler-annotations.md#tuplereturn). LuaMultiReturn can do anything tupleReturn can, with the added benefit of being able to distinguish between actual tuple tables and multiple return values in the type system.
4141
:::
4242

4343
### \$multi
4444

45-
In order to create a function that returns multiple values it needs to return a `MultiReturn<>` type. This is where the `$multi` function comes in. Calling `$multi` in a return statement will create an instance of the `MultiReturn<>` type:
45+
In order to create a function that returns multiple values it needs to return a `LuaMultiReturn<>` type. This is where the `$multi` function comes in. Calling `$multi` in a return statement will create an instance of the `LuaMultiReturn<>` type:
4646

4747
```ts title=multi.ts
48-
function myFunc(): MultiReturn<[string, number]> {
48+
function myFunc(): LuaMultiReturn<[string, number]> {
4949
return $multi("foo", 4);
5050
}
5151

0 commit comments

Comments
 (0)