I've recently gotten curious about this, but why does this work?
local s = "some string"
--calling a method on a string
print(s:sub(n, n,)
--following the principle of the colon syntax, it should be the same as this:
local s = "some string"
print(string.sub(s, n, n)
Obviously, the string doesn't actually contain the function, right?
So, I'd imagine there's a metamethod being fired whenever the function is called on the string. Could anyone go into more detail?
Some guy in Hidden Devs told me it was "faster," is that true as well? And if it is "faster," is it even significant?

4 comments
Not sure if this helps, but from the Lua reference manual it says, "The string library provides all its functions inside the table string. It also sets a metatable for strings where the __index field points to the string table. Therefore, you can use the string functions in object-oriented style.", https://www.lua.org/manual/5.1/manual.html#5.4
It's not faster. And even if it is, it is so tiny I couldn't detect it
Thanks so much @Denny9876, as i expected!
@mybituploads thanks a lot