[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua Short Reference, minor upgrade
- From: Thomas Lauer <thomas.lauer@...>
- Date: Thu, 02 Jul 2009 14:10:17 +0100
Duncan Cross <duncan.cross@gmail.com> wrote:
> I have noticed a few things just skimming it now:
> - One of the table constructors {[-900] = 3, [+900] = 4} - Lua actually does
> not support the "unary plus" and throws a parse error at this.
Ack and changed.
> - Potential for confusion, maybe:
>
> x:move (2, -3)
> object call: shortcut for x.move(x, 2, -3), x will be assigned to self
>
> ..."x will be assigned to self", only if x.move was also created using the
> same syntax. Someone could misread this as 'whatever parameter was named
> "self", wherever it appears in the parameter list, will be set to x'.
What wording would you propose instead? Perhaps removing the "x will be
assigned to self" altogether?
> - setmetatable and setfenv returns the table/function, I don't know if you'd
> consider this worth mentioning in this but I find it quite useful
setmetatable: ack and changed.
setfenv: the manual says "As a special case, when f is 0 setfenv changes
the environment of the running thread. In this case, setfenv returns no
values." So I'll leave it as it is.
> - string.byte also allows two parameters to get the numerical code of each
> character in a range
Ack and changed.
> - Would it be worth mentioning how strings by default have a metatable set
> allowing for method calls that use the string table (and how you can use
> it on string literals only if you put them in parentheses)?
I've included a note to that effect.
Thanks for reporting. I'm going to wait a few more days for possible
further feedback and then go ahead with a new draft.
--
cheers thomasl
web: http://thomaslauer.com/start