lua-users home
lua-l archive

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

I'm sorry. One more thing and then I'll leave you alone:

If you are dealing with functions and you want something to happen
after they are called, such that:

model.method = function(...) return ... end

then your __newindex function can contain this construct:

if type(v) == "function" then
    v = function(...)
      local retval = {v(...)} --unless you know the number of return
values, you need to pack them in a table.

      ---do crazy stuff notify the callbacks in your subs table

       return table.unpack(...)


Okay. Sorry for the noise. Hope this helps and again, if I'm missing
something, please let me know!