Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gsub replacement function parameter type should be variadic string #1161

Closed
SnorlaxAssist opened this issue Feb 5, 2024 · 1 comment · Fixed by #1162
Closed

Gsub replacement function parameter type should be variadic string #1161

SnorlaxAssist opened this issue Feb 5, 2024 · 1 comment · Fixed by #1162

Comments

@SnorlaxAssist
Copy link
Contributor

eg:

const [str, count] = ("ABC").gsub("(%w)(%w)(%w)", (a, b, c) => `${a}/${b}/${c}`);
@Dionysusnu
Copy link
Contributor

Dionysusnu commented Feb 5, 2024

I can't find this actually documented anywhere, but from testing it seems you're right.

("Hello World!"):gsub("(%w)(%w)(%w)", function(a, b, c)
	print(a,b,c)
end)

Running this code in the Luau demo prints

H	e	l
W	o	r

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 a pull request may close this issue.

2 participants