Strings In Depth11 / 14
Up next

Substrings

-- string.sub(s, i, j) is 1-based and inclusive
local s = "hello world"
print(string.sub(s, 1, 5))
-- negative indices count from the end
print(string.sub(s, -5))
What you're solving

string.sub slices by index