Skip to content

Make strings iterable#891

Merged
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
ark120202:iterable-string
Jun 9, 2020
Merged

Make strings iterable#891
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
ark120202:iterable-string

Conversation

@ark120202
Copy link
Copy Markdown
Contributor

@ark120202 ark120202 commented Jun 1, 2020

Resolves #843.

Changelog:

  • Strings now can be iterated over

@Validark
Copy link
Copy Markdown

Validark commented Jun 2, 2020

In roblox-ts, here is how we compile string iteration:

for (const letter of "Iñtërnâtiônàlizætiøn☃💩") {
	print(letter);
}
for letter in string.gmatch("Iñtërnâtiônàlizætiøn☃💩", "[%z\1-\127\194-\244][\128-\191]*") do
	print(letter);
end;

@ark120202
Copy link
Copy Markdown
Contributor Author

Thanks for suggestion, but I don't see much point in trying to properly support unicode just in one place. Consistently not supporting it sounds better than doing it randomly

@Perryvw Perryvw merged commit fddc544 into TypeScriptToLua:master Jun 9, 2020
@ark120202 ark120202 deleted the iterable-string branch June 11, 2020 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strings cannot be iterated

3 participants