This question does not ask if Lua patterns are PCRE. That has been asked multiple times and the answer is definitely no.
Instead, I am asking if Lua patterns have an analogy to regular languages by the formal language definition. My instinct is no because I was not able to create a pattern for this regular language:
L = {'foo'}* = {'', 'foo', 'foofoo', 'foofoofoo', ...}
All my attempts failed because Lua appears to lack the ability to use the Kleene Star on captures:
> print(('foofoo'):find('(foo)*'))
nil
Can you show that there is no pattern in Lua which can denote L
, and more generally, can a Lua pattern be created for any regular language?
Lua patterns are not regular languages. Almost every Lua pattern can be expressed as a regular language, but there are lots of regular expressions that cannot be expressed as a Lua pattern (and at least one Lua pattern that is not regular). And the particular regular construct you're trying to do, match repetitions of a specific sequence of characters, is not possible with Lua patterns. Not in the general case.
Basically, Lua patterns can't do anything that would require decision points based on more than one character in the input stream. Regular languages can.