Lua Cookbook

classic Classic list List threaded Threaded
101 messages Options
1234 ... 6
Reply | Threaded
Open this post in threaded view
|

Lua Cookbook

Alexander Gladysh
Hi, list!

We discussed Lua Cookbook initiative here recently, but without a
definite conclusion.

My vision:

1. We need Lua Cookbook to help educate new users.

2. What "Cookbook" is? We need an explicit definition. Someone who
actually used such things (I never did) please step up, and tell. Look
at "Perl Cookbook" for an inspiration (other good Cookbooks around?
share links please).

3. This should be a book (as something finite). Even if we do not
actually publish it. For book format an collaboration model I suggest
to look at Pro Git book: http://progit.org/ ,
https://github.com/progit .

4. The naïve plan:

-- Define book format
-- Brainstorm a list of topics
-- Cull a list of topics to a list of articles
-- Assign volunteer authors
-- Formulate a submission, collaboration, editing process.
-- Write articles
-- ...
-- PROFIT

5. I should be able to contribute a few articles myself. Few people on
the list volunteered as well (but we need more support!)

6. We should push this plan to the list of articles item. After that
things have a chance to roll on to completion.

Alexander.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Peter Hickman-3
How does this differ from Lua Gems?

On 4 January 2011 10:26, Alexander Gladysh <[hidden email]> wrote:
> 2. What "Cookbook" is? We need an explicit definition. Someone who
> actually used such things (I never did) please step up, and tell.

If you've never used a cookbook then why do you think we need one?
What itch does this scratch for you?

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Alexander Gladysh
On Tue, Jan 4, 2011 at 13:46, Peter Hickman
<[hidden email]> wrote:
> How does this differ from Lua Gems?

Scope of articles. Gems are the cutting-edge for more-or-less
experienced readers, recipes in a cookbook are simpler things for new
users.

Also: you want to say that there was a call for articles for Lua Gems
2 that I missed? I do not think so.

> On 4 January 2011 10:26, Alexander Gladysh <[hidden email]> wrote:
>> 2. What "Cookbook" is? We need an explicit definition. Someone who
>> actually used such things (I never did) please step up, and tell.

> If you've never used a cookbook then why do you think we need one?

Please read the discussion.

> What itch does this scratch for you?

I have an itch to write (technical articles). I'm an amateur writer,
but some people say that my articles are not all garbage. I like
writing about Lua — that is the subject that, I, probably, know best
nowadays.

To scratch my itch I will write about Lua even if Lua Cookbook
initiative will not work (that would be in Russian though).

But I believe that participation in a book should result in a product
of better quality and public benefit than if I wrote some random stuff
all by myself.

Alexander.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Peter Hickman-3
On 4 January 2011 11:02, Alexander Gladysh <[hidden email]> wrote:
> On Tue, Jan 4, 2011 at 13:46, Peter Hickman
> <[hidden email]> wrote:
>> How does this differ from Lua Gems?
>
> Scope of articles. Gems are the cutting-edge for more-or-less
> experienced readers, recipes in a cookbook are simpler things for new
> users.

So for you a Lua Cookbook would be more of a guide to idiomatic Lua
style. Then I would also suggest not just a style guide but an
overview of the sort of common tools that a Lua programmer might work
with. Lunit, Luarocks etc. Then the question becomes what are common
Lua tools / libraries, perhaps by industry sector?

> I have an itch to write (technical articles). I'm an amateur writer,
> but some people say that my articles are not all garbage. I like
> writing about Lua — that is the subject that, I, probably, know best
> nowadays.

Mmm. If technical writing is your itch and you have a native command
of russian then perhaps a "beginners guide to lua" in russian would be
a good starting point. You could start with a series of small
introduction / how-to articles for a russian computer magazine to
build your writing skills and perhaps (with feedback from your readers
as to what they want to learn about) use that to develop your book
writing skills.

Having said that I know nothing about the russian computer press /
scene. It's just an idea :)

> But I believe that participation in a book should result in a product
> of better quality and public benefit than if I wrote some random stuff
> all by myself.

Small focused articles are much easier to write, just pick a topic and write.

* 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)

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Alexander Gladysh
In reply to this post by Alexander Gladysh
On Tue, Jan 4, 2011 at 14:14, Petsagourakis George
<[hidden email]> wrote:
> There are enough Lua books to get a grip on the language.

Another book will not do harm, surely?

Alexander.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Alexander Gladysh
In reply to this post by Peter Hickman-3
On Tue, Jan 4, 2011 at 14:21, Peter Hickman
<[hidden email]> wrote:
> On 4 January 2011 11:02, Alexander Gladysh <[hidden email]> wrote:
>> On Tue, Jan 4, 2011 at 13:46, Peter Hickman
>> <[hidden email]> wrote:
>>> How does this differ from Lua Gems?

>> Scope of articles. Gems are the cutting-edge for more-or-less
>> experienced readers, recipes in a cookbook are simpler things for new
>> users.

> So for you a Lua Cookbook would be more of a guide to idiomatic Lua
> style. Then I would also suggest not just a style guide but an
> overview of the sort of common tools that a Lua programmer might work
> with. Lunit, Luarocks etc. Then the question becomes what are common
> Lua tools / libraries, perhaps by industry sector?

>> I have an itch to write (technical articles). I'm an amateur writer,
>> but some people say that my articles are not all garbage. I like
>> writing about Lua — that is the subject that, I, probably, know best
>> nowadays.

> Mmm. If technical writing is your itch and you have a native command
> of russian then perhaps a "beginners guide to lua" in russian would be
> a good starting point. You could start with a series of small
> introduction / how-to articles for a russian computer magazine to
> build your writing skills and perhaps (with feedback from your readers
> as to what they want to learn about) use that to develop your book
> writing skills.

I'm doing this (albeit slowly). I have several published articles, and
a few online ones.

Moving towards a book without external motivation is hard. :-)

> Having said that I know nothing about the russian computer press /
> scene. It's just an idea :)

Thank you.

>> But I believe that participation in a book should result in a product
>> of better quality and public benefit than if I wrote some random stuff
>> all by myself.

> Small focused articles are much easier to write, just pick a topic and write.

But that is what cookbook is, more or less! :-)

I never said that I will write it all by myself.

> * 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)

Of course (thanks for the list, btw).

But I thought that, since I'm going to do this anyway, and since there
is (or was?) some push towards Cookbook, maybe I could join efforts
with someone else. :-)

Alexander.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Axel Kittenberger
In reply to this post by Alexander Gladysh
> 4. The naïve plan:
> -- Define book format
> -- Brainstorm a list of topics
> -- Cull a list of topics to a list of articles
> -- Assign volunteer authors
> -- Formulate a submission, collaboration, editing process.
> -- Write articles
> -- ...
> -- PROFIT

I support this idea.

As far I get it, a cookbook is some sort of of book an advanced Lua
programmer will page through very quickly and put it back - "boring,
know it all." But for some people like to approach things by reading
something like this (other just open a console and hack away :-). I
would compare it to the rather sucessfull, yellow "[X] for dummies"
series. There might be some overlap to Robertos excellent "Programming
in Lua" in book. Like Queues http://www.lua.org/pil/11.4.html would
fit in the Cookbook very well. But as I see it, the approach would be
different, it would not introduce the very basics of the language, but
refer to Roberto for this, and it would organize things originating
from a common problem. Wile Programming in Lua originates from
Language features and what one can do with it.

About a collaborative friendly format.

Progit uses callibre, do not know that. I recently used asciidoc and
considered it quite ok. One is in Ruby the other in Pyhton.

Brainstorming topics, I suppose one could skim through the mailling
list to find good topics:
Reclling things out of my head
* 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

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

beo wulf
This cookbook is aimed at lua 5.2 right?

On Tue, Jan 4, 2011 at 3:47 AM, Axel Kittenberger <[hidden email]> wrote:

>> 4. The naïve plan:
>> -- Define book format
>> -- Brainstorm a list of topics
>> -- Cull a list of topics to a list of articles
>> -- Assign volunteer authors
>> -- Formulate a submission, collaboration, editing process.
>> -- Write articles
>> -- ...
>> -- PROFIT
>
> I support this idea.
>
> As far I get it, a cookbook is some sort of of book an advanced Lua
> programmer will page through very quickly and put it back - "boring,
> know it all." But for some people like to approach things by reading
> something like this (other just open a console and hack away :-). I
> would compare it to the rather sucessfull, yellow "[X] for dummies"
> series. There might be some overlap to Robertos excellent "Programming
> in Lua" in book. Like Queues http://www.lua.org/pil/11.4.html would
> fit in the Cookbook very well. But as I see it, the approach would be
> different, it would not introduce the very basics of the language, but
> refer to Roberto for this, and it would organize things originating
> from a common problem. Wile Programming in Lua originates from
> Language features and what one can do with it.
>
> About a collaborative friendly format.
>
> Progit uses callibre, do not know that. I recently used asciidoc and
> considered it quite ok. One is in Ruby the other in Pyhton.
>
> Brainstorming topics, I suppose one could skim through the mailling
> list to find good topics:
> Reclling things out of my head
> * 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
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

steve donovan
In reply to this post by Axel Kittenberger
On Tue, Jan 4, 2011 at 1:47 PM, Axel Kittenberger <[hidden email]> wrote:
> As far I get it, a cookbook is some sort of of book an advanced Lua
> programmer will page through very quickly and put it back - "boring,
> know it all." But for some people like to approach things by reading
> something like this (other just open a console and hack away :-). I

Learning to program is not so different from learning a new natural
language, and all the experts agree that one must read a lot in order
to learn to write.   It is helpful to start with manageable chunks of
code and experiment - there the metaphor is to take an existing recipe
and modify it slightly in one's kitchen.  This builds up confidence
and the person can start writing.

But is the cookbook a book in the traditional sense, or a
well-organized website? These are perhaps complementary views of the
same project....

I get the writing itch as well, so I'll think about topics...

steve d.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

steve donovan
In reply to this post by beo wulf
On Tue, Jan 4, 2011 at 1:55 PM, beo wulf <[hidden email]> wrote:
> This cookbook is aimed at lua 5.2 right?

Lua 5.1 is not really very different, certainly not for a Lua coder.

steve d.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Alexander Gladysh
In reply to this post by Axel Kittenberger
On Tue, Jan 4, 2011 at 14:47, Axel Kittenberger <[hidden email]> wrote:

> About a collaborative friendly format.

> Progit uses callibre, do not know that. I recently used asciidoc and
> considered it quite ok. One is in Ruby the other in Pyhton.

Last time I looked, Progit used Markdown (processed with pandoc — a
Haskell program).

https://github.com/progit/progit/raw/master/en/01-introduction/01-chapter1.markdown

> Brainstorming topics, I suppose one could skim through the mailling
> list to find good topics:

<...>

Thank you!

I guess it is time to setup a GitHub organization for this, a GH
project there, and start registering  topics — that appear in mailing
list — there in a wiki. (Unless Lua Team objects, I'd suggest to keep
brainstorming in this list for some time.)

I can do this tomorrow. If someone wishes to step up and do this ahead
of me, please do. :-)

Alexander.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Alexander Gladysh
In reply to this post by steve donovan
On Tue, Jan 4, 2011 at 15:01, steve donovan <[hidden email]> wrote:
> On Tue, Jan 4, 2011 at 1:47 PM, Axel Kittenberger <[hidden email]> wrote:
> But is the cookbook a book in the traditional sense, or a
> well-organized website? These are perhaps complementary views of the
> same project....

I like how ProGit is organized. It is both:

http://progit.org/book/

http://tinyurl.com/amazonprogit

https://github.com/progit/progit

Alexander.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Philippe Lhoste
In reply to this post by Alexander Gladysh
On 04/01/2011 12:14, Petsagourakis George wrote:
> There are enough Lua books to get a grip on the language.

If I understood correctly Alexander's proposal (which I like), one of the benefits of this
one is that it would be free, online. Of course, there is PiL as a good starting point,
but as he said, more matter won't hurt.

Note: I have little experience of existing programming cookbooks, but I felt they are more
or less similar in topics (exposing simple problems, giving solutions), so maybe this base
can be taken and adapted.
There are other collections of small, useful problems, for example:
http://aperiodic.net/phil/scala/s-99/

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Alexander Gladysh
On Tue, Jan 4, 2011 at 12:58, Philippe Lhoste <[hidden email]> wrote:
> On 04/01/2011 12:14, Petsagourakis George wrote:

>> There are enough Lua books to get a grip on the language.

> If I understood correctly Alexander's proposal (which I like), one of the
> benefits of this one is that it would be free, online.

Yes, free and online, that is correct. (That does not mean that it can
coexist with paid printed version as it is with ProGit, but, I
imagine, that to make printed and paid version possible, we would need
to overcome a lot of legal hassle.)

> Of course, there is
> PiL as a good starting point, but as he said, more matter won't hurt.

Indeed.

> Note: I have little experience of existing programming cookbooks, but I felt
> they are more or less similar in topics (exposing simple problems, giving
> solutions), so maybe this base can be taken and adapted.

Right. If you know such book, please share a link, so we can borrow a
few ideas from its a table of contents.

> There are other collections of small, useful problems, for example:
> http://aperiodic.net/phil/scala/s-99/

This one is more of mathematical nature, not that useful for a modern
newbie, I guess.

Alexander.

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Andrew Wilson-4

Here's a generic cross language cookbook where Lua is missing...  http://pleac.sourceforge.net/

Andrew


On Tue, Jan 4, 2011 at 10:14 AM, Alexander Gladysh <[hidden email]> wrote:
On Tue, Jan 4, 2011 at 12:58, Philippe Lhoste <[hidden email]> wrote:
> On 04/01/2011 12:14, Petsagourakis George wrote:

>> There are enough Lua books to get a grip on the language.

> If I understood correctly Alexander's proposal (which I like), one of the
> benefits of this one is that it would be free, online.

Yes, free and online, that is correct. (That does not mean that it can
coexist with paid printed version as it is with ProGit, but, I
imagine, that to make printed and paid version possible, we would need
to overcome a lot of legal hassle.)

> Of course, there is
> PiL as a good starting point, but as he said, more matter won't hurt.

Indeed.

> Note: I have little experience of existing programming cookbooks, but I felt
> they are more or less similar in topics (exposing simple problems, giving
> solutions), so maybe this base can be taken and adapted.

Right. If you know such book, please share a link, so we can borrow a
few ideas from its a table of contents.

> There are other collections of small, useful problems, for example:
> http://aperiodic.net/phil/scala/s-99/

This one is more of mathematical nature, not that useful for a modern
newbie, I guess.

Alexander.


Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Alex Bradbury
In reply to this post by Alexander Gladysh
On 4 January 2011 15:14, Alexander Gladysh <[hidden email]> wrote:
> On Tue, Jan 4, 2011 at 12:58, Philippe Lhoste <[hidden email]> wrote:
>> Note: I have little experience of existing programming cookbooks, but I felt
>> they are more or less similar in topics (exposing simple problems, giving
>> solutions), so maybe this base can be taken and adapted.
>
> Right. If you know such book, please share a link, so we can borrow a
> few ideas from its a table of contents.

I believe the Perl Cookbook [1] is very well-regarded, and with the
first edition being published in 1998 may have spawned the cookbook
format. It also inspired a project PLEAC [2] to translate the examples
to other languages.

[1]: http://oreilly.com/catalog/9780596003135/
[2]: http://pleac.sourceforge.net/

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Luiz Henrique de Figueiredo
In reply to this post by Andrew Wilson-4
> Here's a generic cross language cookbook where Lua is missing...
> http://pleac.sourceforge.net/

This has been mentioned here before more than once but drew no replies.
Perhaps the time is ripe now.

http://lua-users.org/lists/lua-l/2001-08/msg00084.html
http://lua-users.org/lists/lua-l/2001-12/msg00082.html
http://lua-users.org/lists/lua-l/2005-08/msg00074.html
http://lua-users.org/lists/lua-l/2005-08/msg00137.html

Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Philippe Lhoste
In reply to this post by Alexander Gladysh
On 04/01/2011 16:14, Alexander Gladysh wrote:
> Right. If you know such book, please share a link, so we can borrow a
> few ideas from its a table of contents.

As mentioned, the Perl cookbook and its derivatives, which were my initial idea.
The PLEAC also mentioned lists a number of such derivatives.
I can also mention http://rosettacode.org/

>> There are other collections of small, useful problems, for example:
>> http://aperiodic.net/phil/scala/s-99/
>
> This one is more of mathematical nature, not that useful for a modern
> newbie, I guess.

Not only. Problems on lists, trees and graphs are of general interest, and even if some
problems are trivial, they are good introduction to the language/library features.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Philippe Lhoste
On 04/01/2011 16:53, I wrote:
> As mentioned, the Perl cookbook and its derivatives, which were my initial idea.

Well, I really meant "which was what I was thinking about when I mentioned existing
cookbooks". These cookbooks weren't my idea (ie. I didn't created them or something...).

> The PLEAC also mentioned lists a number of such derivatives.
> I can also mention http://rosettacode.org/

http://rosettacode.org/wiki/Category:Lua

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


Reply | Threaded
Open this post in threaded view
|

Re: Lua Cookbook

Alexander Gladysh
In reply to this post by Luiz Henrique de Figueiredo
On Tue, Jan 4, 2011 at 15:34, Luiz Henrique de Figueiredo
<[hidden email]> wrote:
>> Here's a generic cross language cookbook where Lua is missing...
>> http://pleac.sourceforge.net/

> This has been mentioned here before more than once but drew no replies.
> Perhaps the time is ripe now.

Great!

So, what about getting Lua PLEAC from 0 to 100%? :-)

No Lua-specific stuff (like sandboxes and DSLs), but a provides a
concrete and well-defined set of goals.

Alexander.

1234 ... 6