Buffer:sub(start, [end]) method
Extracts part of the Buffer like the function string.sub.
Parameters
start
An index of the Buffer defining the start of the sub-Buffer. That index can be negative (starting to count from the end of the Buffer).
end
An optional index that defines where the sub-Buffer ends. That index can be negative (starting to count from the end of the Buffer).
When that argument is absent, it is assumed to be equal to -1 (end of the Buffer).
Return value
Returns a Buffer value.Example
-- init a Buffer with a string
local b = sys.Buffer("ABC")
-- returns a sub Buffer from b[2] until the end
local newbuff = b:sub(2)
-- outputs "BC"
print(newbuff)