lua-users home
lua-l archive

Re: referencing table elements within the same table constructor

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


On Wed, Jun 9, 2010 at 2:56 PM, Warlich, Christof
<christof.warlich@thermofisher.com> wrote:
> interface = {
..
>     incoming = {
>         SET = function()
>                   print(interface["port"]) -- error!!
What you can do here is ensure that these functions are always passed
the interface table, that is, make that function function(interface)
and call it so interface.incoming.SET(interface). This allows for a
straightforward OOP style.
steve d.

AltStyle によって変換されたページ (->オリジナル) /