Skip to content

RFC: Buffer and string slice syntax#222

Open
GameF200 wants to merge 2 commits into
luau-lang:masterfrom
GameF200:master
Open

RFC: Buffer and string slice syntax#222
GameF200 wants to merge 2 commits into
luau-lang:masterfrom
GameF200:master

Conversation

@GameF200

Copy link
Copy Markdown

@GameF200 GameF200 changed the title [RFC]: Buffer and string slices syntax [RFC]: Buffer and string slice syntax Jul 10, 2026
@GameF200 GameF200 changed the title [RFC]: Buffer and string slice syntax RFC: Buffer and string slice syntax Jul 10, 2026
@deviaze

deviaze commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Just FYI, unfortunately buffer slices were already rejected: #163.

I'd be interested in slicing with new range datatype constructed via concatting numbers though.

local rang = 1..4
for i in rang do
end

local res = t[rang]

@GameF200

GameF200 commented Jul 10, 2026

Copy link
Copy Markdown
Author

Just FYI, unfortunately buffer slices were already rejected: #163.

I'd be interested in slicing with new range datatype constructed via concatting numbers though.

local rang = 1..4
for i in rang do
end

local res = t[rang]

oh i didnt know about #163. Thanks for the context!

@whoamimaybeme

Copy link
Copy Markdown

how would a slice metamethod even work? how would you make it follow the semantics of a slice? within the code example you provide, you just leave the function blank.

@GameF200

Copy link
Copy Markdown
Author

how would a slice metamethod even work? how would you make it follow the semantics of a slice? within the code example you provide, you just leave the function blank.

Oh, thats a tough question. I came up with __slice in the RFC just superficially. I think it's definitely worth reconsidering and standardizing somehow.

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.

3 participants