lua-users home
lua-l archive

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


In comprehension.lua, there is a section that reads:

  -- Convenience syntax.
-- Allows comprehension 'x^2 for x' instead of comprehension['x^2 for x'].
  mt.__call = mt.__index

Unfortunately, when using the calling syntax, it will always recreate the generated list comprehension function.

This fix seems to make it do the right thing:

--  mt.__call = mt.__index
  function mt:__call(expr)
    return self[expr]
  end

Can anyone (David?) comment on this?

Thanks.

Josh