lua-users home
lua-l archive

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

> I can call the functions with mytab.func1(), but I would like to use a reference to the table itself (like the self parameter on Python classes):
> mytab = {
>     func1 = function(self, ?) do something end
>     func2 = function(self, ?) do something other
> }
> and self should be point to mytab. How can I do this?

Your solution using self works fine. Just call the function with mytab:func1().