stringx.splitlines
considers \r\n
a single line ending.stringx.splitlines
returns an empty list for an empty string.tablex.count_map
no longer raises an error.strict.module
correctly handles existing __index
metamethod returning false
.app.parse_args
accepts colon as a separator between option name and value, as advertised.pretty.load
handles case where a C hook is present.
' os.execute
had issue with LuaJIT in 5.2 compat mode.template
supports customizing inline escape character and chunk name.seq
constructor supports iterators with a state object as the second argument.stringx.splitlines
has keep_ends
argument.tablex.reduce
can take an optional initial value.pl.List
, pl.Map
and pl.Set
now require corresponding modules,
so that their methods always work right away.dir.getallfiles
returning an empty array when called without pattern
argument.pl.path
covers edge cases better (e.g 'path.normpath` was broken)p.dir
shell patterns fixedos.tmpname
broken on modern Windows/MSVC14utils.executeex
which depends on it)pretty.write
more robust and does not lose floating-point precision;
saves and restores debug hooks when loading.pl.lexer
fixes: cpp
lexer now filters space by defaulttablex.sortv
no longer assumes that the values are all uniquestringx.center
is now consistent with Python; stringx.rfind
and
string.quote_string
fixed.data.write
had a problem with default delimiter, properly returns error now.pl.Set
+
and -
now have correct semanticspl.tablex
has union
and merge
convenience functionspl.lapp
understands '--' meaning end of parsed argumentsutils.quote_arg
quotes command arguments for os.execute
,
correctly handling all special characters.utils.writefile
has optional is_bin
argumentstringx.endswith
may be passed an array of possible suffixes.data.read
- in CSV mode, assume empty fields are numerical zero-I/usr/include/lua/5.1
Date.Interval
class; toUTC/toLocal
return new object; Date.__tostring
always returns ISO 8601 times for exact serialization. +/-
explicit operators. Date objects
are explicitly flagged as being UTC or not.utils.load
and
utils.unpack
is always available.utils.is_xxx
methods plus new to_bool
.test=klass.lua
). This is
particularly convenient for using from Moonscript.class
false
meant 'not present' (Andrew Starke)true
default(These are all now defined in pl.utils)
pl.app provides useful stuff like simple command-line argument parsing and require_here(), which makes subsequent require() calls look in the local directory by preference.
p.file provides useful functions like copy(),move(), read() and write(). (These are aliases to dir.copyfile(),movefile(),utils.readfile(),writefile())
Custom error trace will only show the functions in user code.
More robust argument checking.
In function arguments, now supports 'string lambdas', e.g. '|x| 2*x'
utils.readfile,writefile now insist on being given filenames. This will cause less confusion.
tablex.search() is new: will look recursively in an arbitrary table; can specify tables not to follow. tablex.move() will work with source and destination tables the same, with overlapping ranges.
dir.copyfile() now works fine without Alien on Windows
dir.makepath() and rmtree() had problems.
tablex.comparenoorder() is now O(NlogN), as expected. tablex.move() had a problem with source size
utils.istype(v,tp) can say istype(s,'string') and istype(l,List). utils.iscallable(v) either a function, or has a __call metamethod.
Sequence wrappers: can write things like this:
seq(s):last():filter('<'):copy()
seq:mapmethod(s,name) - map using a named method over a sequence.
seq:enum(s) If s is a simple sequence, then
for i,v in seq.enum(s) do print(i,v) end
seq:take(s,n) Grab the next n values from a (possibly infinite) sequence.
In a related change suggested by Flemming Madsden, the in-place List methods like reverse() and sort() return the list, allowing for method chaining.
list.join() explicitly converts using tostring first.
tablex.countmap() like seq.countmap(), but takes an equality function.
tablex.difference() set difference tablex.set() explicit set generator given a list of values
Template.indent_substitute() is a new Template method which adjusts for indentation and can also substitute templates themselves.
pretty.read(). This reads a Lua table (as dumped by pretty.write) and attempts to be paranoid about its contents.
sip.matchatstart(). Convenience function for anchored SIP matches.
tablex.deepcompare() was confused by false boolean values, which it thought were synonymous with being nil.
pretty.write() did not handle cycles, and could not display tables with 'holes' properly (Flemming Madsden)
The SIP pattern '$(' was not escaped properly. sip.match() did not pass on options table.
seq.map() was broken for double-valued sequences. seq.copytuples() did not use defaultiter(), so did not e.g. like table arguments.
dir.copyfile() returns the wrong result for *nix operations. dir.makepath() was broken for non-Windows paths.
The map and reduce functions now take the function first, as Nature intended.
The Python-like overloading of '*' for strings has been dropped, since it is silly. Also, strings are no longer callable; use 's:at(1)' instead of 's(1)' - this tended to cause Obscure Error messages.
Wherever a function argument is expected, you can use the operator strings like '+','==',etc as well as pl.operator.add, pl.operator.eq, etc. (see end of pl/operator.lua for the full list.)
tablex now has compare() and comparenoorder(). An explicit set() function has been added which constructs a table with the specified keys, all set to a value of true.
List has reduce() and partition() (This is a cool function which separates out elements of a list depending on a classifier function.)
There is a new array module which generalizes tablex operations like map and reduce for two-dimensional arrays.
The famous iterator over permutations from PiL 9.3 has been included.
David Manura's list comprehension library has been included.
Also, utils now contains his memoize function, plus a useful function args which captures the case where varargs contains nils.
There was a bug with dir.copyfile() where the flag was the wrong way round.
config.lines() had a problem with continued lines.
Some operators were missing in pl.operator; have renamed them to be consistent with the Lua metamethod names.