seqlua

diff README @ 30:367fc70acc15

Respect the __ipairs and __len metamethods
author jbe
date Sat Aug 23 23:13:17 2014 +0200 (2014-08-23)
parents 2c4d9e44f704
children 4fc9090ada1d
line diff
     1.1 --- a/README	Fri Aug 22 12:27:25 2014 +0200
     1.2 +++ b/README	Sat Aug 23 23:13:17 2014 +0200
     1.3 @@ -3,31 +3,23 @@
     1.4  
     1.5  This is an experimental package to extend Lua in the following manner:
     1.6  
     1.7 -* allow ``ipairs(seq)`` to accept tables as well as functions,
     1.8 +* allow ``ipairs(seq)`` to accept tables as well as functions (i.e function
     1.9 +  iterators),
    1.10  * add a new function ``string.concat(separator, seq)`` to concat either table
    1.11    entries or function return values,
    1.12  * provide auxiliary C functions and macros to simplify iterating over both
    1.13    tables and iterator functions with the same statement.
    1.14  
    1.15 -In other words:
    1.16 -When calling ``ipairs(seq)`` or ``string.concat(separator, seq)``,
    1.17 -then ``seq`` may either be a (table) sequence or a (function) iterator.
    1.18 -Auxiliary C functions and macros are provided to simplify extending your own
    1.19 -C functions in the same manner.
    1.20 -
    1.21 -This library completely ignores the ``__ipairs`` metamethod (as it is
    1.22 -deprecated since Lua 5.3.0-alpha). It respects, however, any ``__index`` and
    1.23 -``__call`` metamethods (this may cause unexpected behavior when passing
    1.24 -callable tables to ``ipairs``). The ``__call`` metamethod takes precedence over
    1.25 -an existing ``__index`` metamethod.
    1.26 -
    1.27 +In all cases, existing ``__index``, ``__len``, or ``__ipairs`` metamethods are
    1.28 +respected. The ``__ipairs`` metamethod takes precedence.
    1.29  
    1.30  
    1.31  Lua part of the library
    1.32  -----------------------
    1.33  
    1.34 -The modified ``ipairs(seq)`` function and the new ``string.concat`` function
    1.35 -work as demonstrated in the following examples:
    1.36 +The modified ``ipairs(seq)`` and the new ``string.concat(sep, seq)`` functions
    1.37 +accept either a table or a function as ``seq``. This is demonstrated in the
    1.38 +following examples:
    1.39  
    1.40      require "seqlua"
    1.41  

Impressum / About Us