lua-users home
lua-l archive

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


> Is that expected behavior too, or am I just trying to write so sick
> and nasty code ?? :)

Well, it is expected behavior. Upvalues apply only to variables, not to
fields. When you write %t.a, the binding is (%t).a, and not %(t.a); so,
only the t is frozen, not the field value. If you really want to run
that code, you need a temporary variable:

  t.a = function(s)
    print(s)
  end

  local ta = t.a
  
  t.a = function(s)
    print(s)
    %ta(s)
  end

-- Roberto