Standard Library Proposal

lua-users home
wiki

Difference (from prior major revision) (author diff)

Changed: 1,31c1
See StandardLibraries for the practical details of the project and actual code!

== Rationale ==

Why bother having standard Lua libraries when Lua code is so easy to write? And anyway, isn't Lua mostly used just to script C and C++ programs?

The answer is simply that as in any language (especially in one as small and flexible as Lua) there are a lot of useful wheels that there is no point reinventing. Whether it's support for functional programming (map, curry), string manipulation (split, join) or object orientation (constructors and inheritance), high quality and well-documented code takes time to write and is easy to get wrong. By putting this sort of thing in libraries, a lot of programming tasks can be eased.

Also, Lua isn't just used for scripting. Some people use it to write command-line utilities (hmm, fancy a getopt implementation?). And "scripting" doesn't just mean a few lines of code, anyway. Many scripted applications will have thousands of lines of Lua. Here, not only the libraries themselves, but their structure can be useful in guiding the development of large projects.

== Aims ==

The idea is to take the rag-tag bags of personal utilities we each have, and combine them into a coherent standard library.

Here are some properties the library should have:

*Simple to use (something like require("std")).
*Hierarchical structure, so that for discplined modular programs just the bits required can be imported, whereas simple scripts can just use the whole lot.
*It should follow (and perhaps extend) the recommendations of LTN 7 [1].
*It would be nice if it could be made available by default (like a C library).

== Related efforts ==

* ExtensionProposal - extended os and io API (modules)
* CommonFunctions
* LuaCheia
* LuaLibraryWorkshop

-- ReubenThomas

Such a "standard library" must at the very least be split up into separate libraries of like functionality, so that developers integrating lua can easily enable/disable as much or as little as they want (for security reasons). It also makes it easy to manage lua's size, which is especially important for embedded systems. --DanHollis?
This page moved. See StandardLibraries.

This page moved. See StandardLibraries.
RecentChanges · preferences
edit · history
Last edited January 6, 2007 2:59 pm GMT (diff)