lua-users home
lua-l archive

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


On 10/23/07, Mariano Kamp <mariano.kamp@acm.org> wrote:
> Quick follow up question to the use of local variables to store
> functions: When I use local s_find = string.find can I still use the
> "object oriented" syntax like line ="abc"; hit = line:find("xyz")??

You can. The local variable just keeps the function at a fixed offset
so there's no table lookup. I think 'line:find()' is more elegant, but
it involves looking up 'find' in line's metatable.

steve d.