lua-users home
lua-l archive

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

Luis Carvalho <carvalho <at>> writes:
> I decided to put together a simple tuple implementation based on previous
> discussions in the list

PiL, 2nd ed., 27.3, implements a more minimal form of that same idea.  (PiL also
omits the n <= LUA_MINSTACK check, which I think is ok.)

Your example does illustrate a case where it would be useful for different
functions to have different metatables.  #t should have different behaviors
depending on whether the closure t represents a tuple or something else.  An
alternative is to wrap the closure in a table or, maybe, multiplex the function