Buffer:contains(pattern) method

Checks if the Buffer contains the whole byte pattern.

Parameters

pattern

A string or Buffer value that contains the byte sequence to search for.

Return value

Returns a number representing the byte sequence position in the Buffer, or false if it has not been found.

Example

local buff1 = sys.Buffer { 97, 98, 99 } -- "abc" in utf8 local buff2 = sys.Buffer { 100, 101, 102 } -- "def" in utf8 -- outputs false print(buff1:contains(buff2))