lua-users home
lua-l archive

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

Op Do. 20 Des. 2018 om 10:08 het Gabriel Bertilson
<> geskryf:
> I guess without a table, the arguments can be stored as upvalues. The
> following makes an iterator generator that sets its arguments as
> upvalues to a closure, with the total number of upvalues as the first
> upvalue. (Is there a way to avoid that first upvalue?) Then the
> closure receives an unused first argument and a second argument i, and
> it returns the i-plus-one-th argument to the original function
> (similar to the behavior of the function returned by ipairs). Not sure
> if this is more or less efficient memory-wise than using a table.

Thanks, I learnt something from your elegant code.