lua-users home
lua-l archive

Re: string.len(str) vs str:len()

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Aug 7, 2014 at 3:14 PM, Mason Mackaman <masondeanm@aol.com> wrote:
> Also doesn’t there have to be some emphasis on the locality (can I say that?) of getmetatable(‘’).__index, otherwise it wouldn’t be any faster?
These are unrelated parts. The scope of the variable (whether it is
local or global) matters when getting the variable itself, be it
`string` or `str`. *
[1] In the latter case, before even looking for the metatable. In
fact, lua doesn't call gemetatable() per se, but actually uses that
instruction `SELF` Tim mentioned earlier, which then internally looks
for the metatable.
-- 
NI!
() - www.asciiribbon.org
/\ - ascii ribbon campaign against html e-mail and proprietary attachments

AltStyle によって変換されたページ (->オリジナル) /