|
Since s is a string, its metatable is the string metatable, so it inherits all methods from string. So s.find is the same method as string.find:> s='hello there hi'> s.findfunction: 0x4225d0> string.findfunction: 0x4225d0So you can execute either s.find or string.find and they give the same result. This is most useful when using the object syntax you described, since s:find('there') can be used instead of s.find(s,'there') or string.find(s,'there').On Fri, Jun 16, 2017 at 3:36 PM, John Gabriele <jgabriele@fastmail.fm> wrote:Hi lua-l,I understand that:> s = 'hello there hi'> -- this> s:find('there')7 11> -- is the same as> s.find(s, 'there')7 11but what exactly is going on with:> -- this> s.find(s, 'there')7 11> -- vs> string.find(s, 'there')7 11?Thanks,-- John