lua-users home
lua-l archive

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


Mark Hamburg wrote:

My guess, however, would be that the __index approach is faster in the long
run because while it makes the initialization case more expensive (it
requires a Lua function call), it does the detection as part of the standard
table fetch logic.

indeed, of course at the expense of an extra table, but that seldom is an issue; the __index method is of course also cleaner

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------