Skip to content

Releases: lua-stdlib/lua-stdlib

[ANN] released stdlib 41.2.1

08 Aug 05:04

Choose a tag to compare

stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.

I am happy to announce release 41.2.1 of stdlib.

stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib

Noteworthy changes in release 41.2.1 (2017-08-07) [stable]

Bug fixes

  • std.version reports the correct release again

Install it with LuaRocks, using:

luarocks install stdlib 41.2.1 

[ANN] stdlib 41.2.0 released

08 Mar 20:51

Choose a tag to compare

stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.

I am happy to announce release 41.2.0 of stdlib.

stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib

Noteworthy changes in release 41.2.0 (2015-03-08) [stable]

New features

  • New iterators, std.npairs and std.rnpairs behave like std.ipairs and std.ripairs resp., except that they will visit all integer keyed elements, including nil-valued "holes". This is useful for iterating over argument lists with nils:

    functionfn (a, b, c) for_, vinnpairs{...} doprint (v) endfn (nil, nil, 3) --> nil nil 3
  • New debug.getfenv and debug.setfenv that work with Lua 5.2 and 5.3.

  • debug.argscheck will skip typecheck for self parameter if the function name specification contains a colon.

  • New debug.resulterror is much like debug.argerror, but uses the message format "bad result #n from 'fname'".

  • New debug.extramsg_mismatch to generate extramsg argument for debug.argerror or debug.resulterror on encountering a type mismatch.

  • New debug.extramsg_toomany to generate a too many arguments or similar extramsg argument.

Deprecations

  • debug.toomanyargmsg has been deprecated in favour of the more orthogal debug.extramsg_toomany api. You can rewrite clients of deprecated api like this:

    ifmaxn (argt) >7thenargerror ("fname", 8, extramsg_toomany ("argument", 7, maxn (argt)), 2) end

Bug fixes

  • std.getmetamethod no longer rejects non-table subjects when _DEBUG.argcheck is set.
  • functional.bind, functional.collect, functional.compose, functional.filter and functional.map propagate nil valued arguments correctly.
  • functional.callable no longer raises an argument error when passed a nil valued argument.
  • debug.argcheck and debug.argscheck accept "bool" as an alias for "boolean" consistently.
  • io.catdir and io.dirname no longer leak extra results from implementation details.

Incompatible changes

  • functional.collect uses std.npairs as a default iterator rather than std.ipairs.

Install it with LuaRocks, using:

luarocks install stdlib 41.2.0 

[ANN] stdlib 41.1.1 released

31 Jan 12:57

Choose a tag to compare

stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.

I am embarrassed to announce release 41.1.1 of stdlib.

stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib

Yesterday's release had a infinite loop bug when used with Lua 5.3. This release fixes that bug but is otherwise identical to 41.1.0.

Noteworthy changes in release 41.1.1 (2015-01-31) [stable]

Bug fixes

  • std.barrel no longer gets stuck in an infinite loop when called in Lua 5.3.

Install it with LuaRocks, using:

luarocks install stdlib 41.1.1 

[ANN] stdlib 41.1.0 released

30 Jan 18:31

Choose a tag to compare

stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.

I am happy to announce release 41.1.0 of stdlib.

stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib

This release overhauls the strbuf class, adds result type checking to the experimental gradual type checking system used throughout stdlib, as well as fixing some bugs. There is also a big backwards incompatibility in the
debug.argscheck syntax, which may affect early adopters, but I decided not to bump the major release number as the API is brand new, and still somewhat in flux. That said, this release is a recommended upgrade for all users.

Noteworthy changes in release 41.1.0 (2015-01-30) [stable]

New features

  • Anything that responds to tostring can be appended to a std.strbuf:

    locala, b=StrBuf{"foo", "bar" }, StrBuf{"baz", "quux" } a=a..b--> "foobarbazquux"
  • std.strbuf stringifies lazily, so adding tables to a StrBuf object, and then changing the content of them before calling tostring also changes the contents of the buffer. See LDocs for an example.

  • debug.argscheck accepts square brackets around final optional parameters, which is distinct to the old way of appending ? or |nil in that no spurious "or nil" is reported for type mismatches against a final bracketed argument.

  • debug.argscheck can also check types of function return values, when specified as:

    fn=argscheck ("fname (?any...) => int, table or nil, string", fname)

    Optional results can be marked with brackets, and an ellipsis following the final type denotes any additional results must match that final type specification. Alternative result type groups are separated by "or".

  • New table.unpack (t, [i, [j]]) function that defaults j to table.maxn (t), even on luajit which stops before the first nil valued numeric index otherwise.

Deprecations

  • std.strbuf.tostring has been deprecated in favour of tostring. Why write std.strbuf.tostring (sb) or sb:tostring () when it is more idiomatic to write tostring (sb)?

Bug fixes

  • std.barrel and the various monkey_patch functions now return their parent module table as documented.
  • stdlib modules are all std.strict compliant; require "std.strict" before requiring other modules no longer raises an error.
  • debug.argscheck can now diagnose when there are too many arguments, even in the case where the earlier arguments match parameters by skipping bracketed optionals, and the total number of arguments is still less than the absolute maximum allowed if optionals are counted too.
  • package.normalize now leaves valid ./../../ path prefixes unmolested.

Incompatible changes

  • debug.argscheck requires nil parameter type ? notation to be prepended to match Specl and TypedLua syntax. ? suffixes are a syntax error.
  • debug.argscheck uses ... instead of * appended to the final element if all unmatched argument types should match. The trailing * syntax was confusing, because it was easy to misread it as "followed by zero-or-more of this type".

Install it with LuaRocks, using:

luarocks install stdlib 41.1.0 

[ANN] stdlib 41.0.0 released

03 Jan 19:07

Choose a tag to compare

stdlib is a library of modules for common programming tasks, including list, table and functional operations, objects, pickling, pretty-printing and command-line option parsing.

I am happy to announce release 41.0.0 of stdlib.

stdlib's home page is at http://lua-stdlib.github.io/lua-stdlib

With this release stdlib is moving to semantic versioning. It is a beta release because it constitutes a virtual rewrite, including a fairly substantial reorganisation that makes the libraries clearer and easier to use, but at the cost of drop-in backwards compatibility. In particular, the list module is liable to change radically for better functional programming support in an upcoming release.

Some of the newest features, such as gradual typing at API boundaries, and interfacing with the std.debug module are somewhat half-baked, so you shouldn't use them unless you are happy to rewrite your code for future releases of stdlib.

None-the-less, this is a useful and solid update, and is worth upgrading to now if you plan to transition to future stable releases without the pain of everything changing all at once... especially if you want to support the upcoming Lua 5.3 release.

Noteworthy changes in release 41.0.0 (2015-01-03) [beta]

New features

  • Preliminary Lua 5.3.0 compatibility.

  • object.prototype now reports "file" for open file handles, and "closed file" for closed file handles.

  • New debug.argerror and debug.argcheck functions that provide Lua equivalents of luaL_argerror and luaL_argcheck.

  • New debug.argscheck function for checking all function parameter types with a single function call in the common case.

  • New debug.export function, which returns a wrapper function for checking all arguments of an inner function against a type list.

  • New _DEBUG.argcheck field that disables debug.argcheck, and changes debug.argscheck to return its function argument unwrapped, for production code. Similarly _DEBUG = false deactivates these functions in the same way.

  • New std.operator module, with easier to type operator names (conj, deref, diff, disj, eq, neg, neq, prod, quot, and sum), and a functional operator for concatenation concat; plus new mathematical operators mod, and pow; and relational operators lt, lte, gt and gte.

  • functional.case now accepts non-callable branch values, which are simply returned as is, and functable values which are called and their return value propagated back to the case caller. Function values behave the same as in previous releases.

  • functional.collect, functional.filter, functional.map and functional.reduce now work with standard multi-return iterators, such as std.pairs.

  • functional.collect defaults to using std.ipairs as an iterator.

  • New functional.cond, for evaluating multiple distinct expressions to determine what following value to be the returned.

  • functional.filter and functional.map default to using std.pairs as an iterator.

  • The init argument to functional.foldl and functional.foldr is now optional; when omitted these functions automatically start with the left- or right-most element of the table argument resp.

  • New functional.callable function for unwrapping objects or primitives that can be called as if they were a function.

  • New functional.lambda function for compiling lambda strings:

    table.sort (t, lambda"|a,b| a<b")

    or, equivalently using auto-arguments:

    table.sort (t, lambda"= _1 < _2")
  • New functional.map_with that returns a new table with keys matching the argument table, and values made by mapping the supplied function over value tables. This replaces the misplaced, and less powerful list.map_with.

  • functional.memoize now propagates multiple return values correctly. This allows memoizing of functions that use the return nil, "message" pattern for error message reporting.

  • New functional.nop function, for use where a function is required but no work should be done.

  • New functional.zip, which in addition to replacing the functionality of deprecated list.transpose when handling lists of lists, correctly zips arbitrary tables of tables, and is orthogonal to functional.map. It is also more than twice as fast as list.transpose, processing with a single pass over the argument table as opposed to the two passes and addition book-keeping required by list.transposes algorithm.

  • New functional.zip_with, subsumes functionality of deprecated list.zip_with, but also handles arbitrary tables of tables correctly, and is orthogonal to functional.map_with.

  • std module now collects stdlib functions that do not really belong in specific type modules: including std.assert, std.eval, and std.tostring. See LDocs for details.

  • New std.ipairs function that ignores __ipairs metamethod (like Lua 5.1 and Lua 5.3), while always iterating from index 1 through n, where n is the last non-nil valued integer key. Writing your loops to use std.ipairs ensures your code will behave consistently across supported versions of Lua.

    All of stdlib's implementation now uses std.ipairs rather than ipairs internally.

  • New std.ielems and std.elems functions for iterating sequences analagously to std.ipairs and std.pairs, but returning only the value part of each key-value pair visited.

  • New std.ireverse function for reversing the proper sequence part of any table.

  • New std.pairs function that respects __pairs metamethod, even on Lua 5.1.

    All of stdlib's implementation now uses std.pairs rather than pairs internally. Among other improvements, this makes for a much more elegant imlementation of std.object, which also behaves intuitively and consistently when passed to std.pairs.

  • std.require now give a verbose error message when loaded module does not meet version numbers passed.

  • New std.ripairs function for returning index & value pairs in reverse order, starting at the highest non-nil-valued contiguous integer key.

  • New table.len function for returning the length of a table, much like the core # operation, but respecing __len even on Lua 5.1.

  • New table.insert and table.remove that use table.len to calculate default pos parameter, as well as diagnosing out of bounds pos parameters consistently on any supported version of Lua.

  • table.insert returns the modified table.

  • New table.maxn is available even when Lua compiled without compatibility, but uses the core implementation when possible.

  • New table.okeys function, like table.keys except that the list of keys is returned with numerical keys in order followed by remaining keys in asciibetical order.

  • std.tostring, std.string.prettytostring and the base std.object__tostring metamethod now all use table.okeys to sort keys in the generated stringification of a table.

Deprecations

  • Deprecated APIs are kept for a minimum of 1 year following the first release that contains the deprecations. With each new release of lua-stdlib, any APIs that have been deprecated for longer than that will most likely be removed entirely. You can prevent that by raising an issue at https://github.com/lua-stdlib/lua-stdlib/issues explaining why any deprecation should be reinstated or at least kept around for more than 1 year.

  • By default, deprecated APIs will issue a warning to stderr on every call. However, in production code, you can turn off these warnings entirely with any of:

    _DEBUG=false_DEBUG={deprecate=false } require"std.debug_init".deprecate=false

    Or, to confirm you're not trying to call a deprecated function at runtime, you can prevent deprecated functions from being defined at all with any of:

    _DEBUG=true_DEBUG={deprecate=true } require"std.debug_init".deprecate=true

    The _DEBUG global must be set before requiring any stdlib modules, but you can adjust the fields in the std.debug_init table at any time.

  • functional.eval has been moved to std.eval, the old name now gives a deprecation warning.

  • functional.fold has been renamed to functional.reduce, the old name now gives a deprecation warning.

  • functional.op has been moved to a new std.operator module, the old function names now gives deprecation warnings.

  • list.depair and list.enpair have been moved to table.depair and table.enpair, the old names now give deprecation warnings.

  • list.filter has been moved to functional.filter, the old name now gives a deprecation warning.

  • list.flatten has been moved to table.flatten, the old name now gives a deprecation warning.

  • list.foldl and list.foldr have been replaced by the richer functional.foldl and functional.foldr respectively. The old names now give a deprecation warning. Note that List object methods foldl and foldr are not affected.

  • list.index_key and list.index_value have been deprecated. These functions are not general enough to belong in lua-stdlib, because (among others) they only work correctly with tables that can be inverted without loss of key values. They currently give deprecation warnings.

  • list.map and list.map_with has been deprecated, in favour of the more powerful new functional.map and functional.map_with which handle tables as well as lists.

  • list.project has been deprecated in favour of table.project, the old name now gives a deprecation warning.

  • list.relems has been deprecated, in favour of the more idiomatic functional.compose (std.ireverse, std.ielems).

  • list.reverse has been deprecated in favour of the more general and more accurately named std.ireverse.

  • list.shape has been deprecated in favour of table.shape, the old name now gives a deprecation warning.

  • list.transpose has been deprecated in favour of functional.zip, see above for details.

  • list.zip_with has been deprecated in favour...

Read more