Table of Contents Brainstorming
Lua Cookbook Table of Contents Brainstorming
WARNING: THIS PAGE IS FROZEN. PLEASE CONTRIBUTE TO THE TOC PAGE
See also The Purpose
Topics Proposals
Peter Hickman (from Lua-ML):
- Installing Lua from source
- Extending the Lua interpreter
- Embedding Lua in C (for games programming)
- Linking C libraries to Lua
- Using Luarocks / Lunit
- Creating you own Luarocks module
- Testing / Profiling / Debugging Lua scripts
- Using databases with Lua
- Web scraping with Lua (http libraries including ssl)
- Serving web sites with Lua (Kepler, Tir, Mongrel, lighttpd)
Axel Kittenberger (from Lua-ML):
- anonymous recursion
- sandboxing
- auto magic tables
- getopt()-like solutions
- chain(like?) lists - (any list operation where random insert/delete is cheap)
- multidimensional arrays
- building GUIs
- slices (refer to penlight?)
- handling XML
- detecting loop-hanged scripts when calling from C
Pierre Chapuis:
- Functional programming in Lua
- State Machines
- Message Passing & distribution (concurrentlua?)
- Persistence options (Lua source, Luabins, Pluto...)
- Interacting with APIs in Lua (Spore?)
A lot of Lua-ML participants:
- Aproaches to Object Oriented Programming
- Data Structures (although there's a big overlap with PIL here so I dunno)
- Because of the differences and idioms in Lua I think some of the seminal topics from PLEAC would be great too: strings, numbers, arrays and hashes.
- Recommended reading etc.
- Installing Lua on popular OSes
- Lua gotchas
- Modules: creation and exporting techniques
- pros and cons of
module,moduleconsidered harmful, and how to cope in amodule-less world.
- pros and cons of
- (Function) Environments: pre- and post-5.1
- Overlaps with Sandboxing, although that is one particular use for environments.
- Rolling your own iterators
- Hole-y tables and the # operator
- part of Lua's gotchas?
- could be the name of the section :)
Some observations:
- Coroutines are little-known enough that they might deserve a chapter of their own, although I'm not sure how much would go there and how much would be distributed to other articles.
- Lua-wiki would be quite the head-start for a lot of these articles.
By Vadim Peretokin (private mail):
http://lua-users.org/wiki/TutorialDirectory is a golden mine to start with things, but some of the explanations are a bit too dense to somebody who doesn't even know the basics of programming and is learning by examples.
So, here are some things I've ran into that require explanation, which might be good for the cookbook.
- table usage - both list-style and key-pair style. Iterating them, setting values, why is a list different from a hash (for example, a hash you can't get duplicate keys, list, you can...)
- concept of strings - they get quite confused between quotes, single quotes, concatenated strings and etc. Something that clearly explains what a string exactly looks like would be nice (using them inside string.format was a disaster once for some people).
Idiomatic usage: Lua-centric (extending Lua for the problem domain), vs. Embedding (extending problem domain code with Lua, or something like that)
Building a DSL in Lua (with "Lua parser", with some simpler parser like one LHF recently announced)
Writing a config file with Lua
Wild idea: changing Lua syntax (token filters, Metalua, source patching discouraged), also worth mentioning means to work with Lua code: parsers etc.
Global environment protection, off-line and runtime.
Alternative Lua implementations: LuaJIT, Java, .Net, Flash, JavaScript.
http://lua-users.org/wiki/LuaDirectory
All the ways to write Lua bindings
Static code validation: lua-inspector etc.
Editors and IDEs: where to edit Lua
Please add your favorite topics here!
Chapter Proposal
Just to get our apetite going, let's try to figure out a series of chapters for the book:
-
Installing Lua
- Installing Lua from source
- Installing Lua on popular OSes
- Strings
- Numbers
-
Tables
- auto magic tables
- why is a list different from a hash
- Setting values in a table (table.insert and the likes)
- Hole-y tables and the # operator
- Functions
-
Data Structures
- chain(like?) lists - (any list operation where random insert/delete is cheap)
- multidimensional arrays
- slices (refer to penlight?)
- proxies
-
Iterators
- Rolling your own iterators
- Chaining iterators
- Filters
-
Pattern Matching
- LPeg patterns and tricks
- Dates and Times
- File System
-
Coroutines
- Schedulers
-
Environments
- Sandboxing
- (Function) Environments: pre- and post-5.1
- Global environment protection, off-line and runtime.
-
Modules
- pros and cons of
module -
moduleconsidered harmful - how to cope in a
module-less world
- pros and cons of
-
Testing, Profiling & Debugging
- Using Lunit
- Testing / Profiling / Debugging Lua scripts
-
Package Management
- Using LuaRocks
- Creating you own LuaRocks module
-
Lua & C
- Extending the Lua interpreter
- Embedding Lua in C
- Linking C libraries to Lua
- detecting loop-hanged scripts when calling from C
-
Other Platforms
- Using fixed-point integers as Lua numbers
- Alternative Lua implementations: LuaJIT, Java, .Net, Flash, JavaScript.
-
Embedding & Extending
- Idiomatic usage: Lua-centric (extending Lua for the problem domain), vs. Embedding (extending problem domain code with Lua, or something like that)
- Writing a config file with Lua
- Building a DSL in Lua (with "Lua parser", with some simpler parser like one LHF recently announced)
- Wild idea: changing Lua syntax (token filters, Metalua, source patching discouraged), also worth mentioning means to work with Lua code: parsers etc.
-
Object Oriented Programming
- Classes and Prototypes
- Inheritance
-
Functional Programming
- higher order functions: map, filter, fold
- anonymous recursion
-
Persistence
- Using databases with Lua
- Persistence options (Lua source, Luabins, Pluto...)
-
Interactivity
- building GUIs
- getopt()-like solutions
-
Process Management and Communication
- Message Passing & distribution (concurrentlua?)
- Sockets
-
Web
- handling XML
- Serving web sites with Lua (Kepler, Tir, Mongrel, lighttpd)
- Web scraping with Lua (http libraries including ssl)
-
Recommended Reading
- Books
- Tutorial Sites
- Project Sites
- Currently homeless suggestions:
- State Machines
- Interacting with APIs in Lua (Spore?)
- All the ways to write Lua bindings
- Static code validation: lua-inspector etc.
- Editors and IDEs: where to edit Lua
- Some GOF design patterns in Lua?
- More on error handling: try/catch; nil, err etc.
- Serialization
- Bit-lib etc
- How to build an executable from a bunch of Lua code (on Linux and Windows)
- Löve and other Lua-aware game engines
- elua and other stuff for embedded hardware
- Lua documentation generators (how to use luadoc etc)
WARNING: THIS PAGE IS FROZEN. PLEASE CONTRIBUTE TO THE TOC PAGE