Versioning is strictly according to Semantic Versioning, see the README.md for details on version scoping and deprecation policy.
see CONTRIBUTING.md for release instructions
- fix: warn
unquoted argument
#439
- fix: xml.parse
returned nonsense when given a file name
#431
- feat: app.require_here
now follows symlink'd main modules to their directory
#423
- fix: pretty.write
invalid order function for sorting
#430
- fix: compat.warn
raised write guard warning in OpenResty
#414
- feat: utils.enum
now accepts hash tables, to enable better error handling
#413
- feat: utils.kpairs
new iterator over all non-integer keys
#413
- fix: warn
use rawget to not trigger strict-checkers
#437
- fix: lapp
provides the file name when using the default argument
#427
- fix: lapp
positional arguments now allow digits after the first character
#428
- fix: path.isdir
windows root directories (including drive letter) were not considered valid
#436
- deprecate: module pl.text
the contents have moved to pl.stringx
(removal later)
#407
- deprecate: module pl.xml
, please switch to a more specialized library (removal later)
#409
- feat: utils.npairs
added. An iterator with a range that honours the n
field
#387
- fix: xml.maptags
would hang if it encountered text-nodes
#396
- fix: text.dedent
didn't handle declining indents nor empty lines
#402
- fix: dir.getfiles
, dir.getdirectories
, and dir.getallfiles
now have the
directory optional, as was already documented
#405
- feat: array2d.default_range
now also takes a spreadsheet range, which means
also other functions now take a range. #404
- fix: lapp
enums allow patterns magic characters
#393
- fix: text.wrap
and text.fill
numerous fixes for handling whitespace,
accented characters, honouring width, etc.
#400
- feat: text.wrap
and text.fill
have a new parameter to forcefully break words
longer than the width given.
#400
- fix: stringx.expandtabs
could error out on Lua 5.3+
#406
- fix: pl
the module would not properly forward the newindex
metamethod
on the global table.
#395
- feat: utils.enum
added to create enums and prevent magic strings
#408
- change: xml.new
added some sanity checks on input
#397
- added: xml.xml_escape
and xml.xml_unescape
functions (previously private)
#397
- feat: xml.tostring
now also takes numeric indents (previously only strings)
#397
- fix: xml.walk
now detects recursion (errors out)
#397
- fix: xml.clone
now detects recursion (errors out)
#397
- fix: xml.compare
now detects recursion (errors out)
#397
- fix: xml.compare
text compares now work
#397
- fix: xml.compare
attribute order compares now only compare if both inputs provide an order
#397
- fix: xml.compare
child comparisons failing now report proper error
#397
stringx.strip
behaved badly with string lengths > 200
#382path.currentdir
now takes no arguments and calls lfs.currentdir
without argument
#383utils.raise_deprecation
now has an option to NOT include a
stack-trace #385permute.iter
, renamed to permute.order_iter
(removal later)
#360permute.table
, renamed to permute.order_table
(removal later)
#360Date
module (removal later)
#367permute.list_iter
to iterate over different sets of values
#360permute.list_table
generate table with different sets of values
#360utils.raise_deprecation
#361utils.splitv
now takes same args as split
#373dir.rmtree
failed to remove symlinks to directories
#365pretty.write
could error out on failing metamethods (Lua 5.3+)
#368app.parse
now correctly parses values containing '=' or ':'
#373dir.makepath
failed to create top-level directories
#372array2d
module was updated, got additional tests and several
documentation updates
#377aray2d
now accepts negative indicesarray2d.row
added to align with column
array2d.map
array2d.flatten
now ensures to deliver a 'square' result if nil
is
encounteredarray2d.transpose
addedarray2d.swap_rows
and array2d.swap_cols
now return the arrayaray2d.range
correctly recognizes R
column in spreadsheet format, was
mistaken for R1C1
format.aray2d.range
correctly recognizes 2 char column in spreadsheet formatarray2d.default_range
added (previously private)array2d.set
if used with a function now passes i,j
to the function
in line with the new
implementation.array2d.iter
didn't properly iterate the indices
#376array2d.columns
now returns a second value; the column indexarray2d.rows
added to be in line with columns
pl.class
, _init
can now be inherited from grandparent (or older ancestor) classes. #289dir
, lexer
, and permute
to no longer use coroutines. #344pretty.debug
quickly dumps a set of values to stdout for debug purposespretty.write
: now also sorts non-string keys #319stringx.count
has an extra option to allow overlapping matches
#326types.is_empty
on the 1.6.0 changelog, due
to additional fixed behaviour not called out appropriately #313path.packagepath
now returns a proper error message with names tried if
it failsstringx.rfind
now properly works with overlapping matches
#314package.searchpath
(in module pl.compat
)
#328path.isabs
now reports drive + relative-path as false
, eg. "c:some/path" (Windows only)dir.dirtree
, pl.lexer
, pl.permute
. If
available the original coroutine functions are now used #329pl.strict
also predefine global _PROMPT2
pl.strict
apply tostring
to the given name, in case it is not a string.utils.quote_arg
will now optionally take an array of arguments and escape
them all into a single string.app.parse_args
now accepts a 3rd parameter with a list of valid flags and aliassesapp.script_name
returns the name of the current script (previously a private function)utils.quit
: exit message is no longer required, and closes the Lua state (on 5.2+).utils.assert_arg
and utils.assert_string
: now return the validated valuepl.compat
: now exports the jit
and jit52
flagspretty.write
: now sorts the output for easier diffs #293utils.raise
changed the global on_error
-level when passing in bad argumentsutils.writefile
now checks and returns errors when writingcompat.execute
now handles the Windows exitcode -1 properlytypes.is_empty
would return true on spaces always, independent of the parametertypes.to_bool
will now compare case-insensitive for the extra passed stringsapp.require_here
will now properly handle an absolute base pathstringx.split
will no longer append an empty match if the number of requested
elements has already been reached #295path.common_prefix
and path.relpath
return the result in the original casing
(only impacted Windows) #297dir.copyfile
, dir.movefile
, and dir.makepath
create the new file/path with
the requested casing, and no longer force lowercase (only impacted Windows)
#297path.getmtime
#291stringx.rpartition
returned bad results on a not-found #299pl.compat
now provides unpack
as table.unpack
on Lua 5.1utils.unpack
is now documented and respects .n
field of its argument.tablex.deepcopy
and tablex.deepcompare
are now cycle aware (#262)seq.last
returning nil
instead of an empty list when given an empty iterator (#253).pl.template
now applies tostring
when substituting values in templates, avoiding errors when they are not strings or numbers (#256).pl.import_into
not importing some Penlight modules (#268).types.is_empty
returning true
on tables containing false
key (#267).types.is_empty
returning false
if not a nil/table/stringtest.assertraise
throwing an error when passed an array with a function to call plus its arguments (#272).test.assertraise
not throwing an error when given function does not error but instead returns a string matching given error pattern._1-(_2+_3)
was evaluated as (_1-_2)+_3
.(-_1)^_2
) was evaluated as -(_1^2)
).pl.stringx.strip
(#275)compat.execute
behaving differently on Lua 5.1 and 5.1+.lapp.process_options_string
setting global success
variable.template.compile
function that allows caching compiled template and rendering it multiple times._debug
field to environment table argument in template.substitute
for printing generated template code upon render error.attempt to concatenate a nil value (local 'vtype')
) in lapp.process_options_string
.lapp.process_options_string
.dir.getfiles
matching given pattern against full paths from base directory instead of file names.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<?xml...>
-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)<?xml...>
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.