Searching for bit pattern inside a table

I’m searching for a good peace of code to search in a 2D Array (table) for a bit pattern?

I have a table (10x10) with values (1…5)

0000000000

0000000000

0000000000

0000000000

0000100000

0001110000

0000000000

0000000000

0000000000

0000000000

I try to find out if inside the table a bit pattern is visible like 

010

111

How do you build the table you want to search?

I initialize the table with two simple loops:

cxMax, cyMax = 10, 10 cubes = {} for cx = 1, cxMax, 1 do cubes[cx] = {} for cy = 1, cyMax, 1 do cubes[cx][cy] = 0 end end

during the game some values add to the table and switches 0 to 1 

then I like to search for the pattern e.g

010

111

and if I found it I know the user has confirm the level…

How do you build the table you want to search?

I initialize the table with two simple loops:

cxMax, cyMax = 10, 10 cubes = {} for cx = 1, cxMax, 1 do cubes[cx] = {} for cy = 1, cyMax, 1 do cubes[cx][cy] = 0 end end

during the game some values add to the table and switches 0 to 1 

then I like to search for the pattern e.g

010

111

and if I found it I know the user has confirm the level…