lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi all,
I'm learning Lua to integrate it in an embedded product. I'm enthusiastic about how powerful the language is, compared to its simplicity and hope to use it for other projects too. With that in mind, please don't take the comments below as dismissal. I want Lua to be the best it can, and after 1-2 weeks of experience this is my attempt to contribute with first impressions and errata. I didn't receive the Programming in Lua book yet so this is all from online sources.

In the interactive interpreter I constantly find myself typing an _expression_ or variable name, expecting to see the result printed back. Prepending '=' helps but doesn't come naturally. Variable names even start a new scope ('>>') that I have to abort. I saw some distribution that makes interactive evaluation more convenient, but it's not on the "Getting Started" page [1] where it's most needed. Also, I don't see why the standard interpreter can't make the default behavior easier to use.
I'm surprised there's no built-in function to print the contents of a table. I looked at lua-stdlib [2] but it doesn't define such a function either.

I've started updating the Lua Short Reference [3] to 5.2. I suppose nobody did it yet? I can post a preliminary version but as a newbie I have trouble finding and summarizing some information.

In particular I haven't found a good description of syntax and semantics of __pairs/__ipairs metamethods. The wiki [4] talks of 'pairs' as an experimental feature and also mentions 'next' which wasn't even included in 5.2? I think the page isn't updated for 5.2?

These metamethods are not listed in the 5.2 manual:
__mode, __pairs, __ipairs, __gc, __metatable, __tostring
And 6.2 'Coroutine Manipulation' states that coroutine operations "comprise a sub-library of the basic library", which is no longer true.
Also, 6.4.1 'Patterns' doesn't explain the now official %f pattern.

I've also not seen an official explanation of '_' as a variable. Googling brought up an answer [5] but I do expect at least the Lua syntax definition [6] to cover variable naming.

Online information quite often refers to 5.1, not 5.2. That has been quite confusing and I've learned more 5.1 details than I care to. Would someone be kind enough to put disclaimers in the online versions of manual 1.5 and PIL where information changed to 5.2? More than once, I've realized I was reading obsolete instructions. Indeed, googling for "Lua manual" gives the 5.1 manual as first hit and 5.2 only as second. For example, I found the online PIL chapter User-Defined Types in C [7] confusing, with the obsolete luaL_openlib. The wiki [8] didn't help much in this regard.

Error in luafaq [9] '8.2.2 Bit Operations Library': The list of available functions is not correct. They should be: band, extract, bor, bnot, arshift, rshift, rrotate, replace, lshift, lrotate, btest, bxor

Many thanks to PUC-Rio and the community for this great language!
Best regards
/Anders Petersson