lua-users home
lua-l archive

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


Fabien <fleutot+lua@gmail.com> writes:

> On Wed, Sep 15, 2010 at 11:35 AM, David Kastrup <dak@gnu.org> wrote:
>
>     Fabien <fleutot+lua@gmail.com> writes:
>    
>     > "foo(bar)(gnu)(gnat)" is understood differently from "foo(bar)\
>     n(gnu)(gnat)".
>    
>     Huh?  What makes you think that?  Aren't you confusing "\n" with
>     ";"?\
>
>
> $ lua
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
>> x=0
>> function f() print ("call #"..x); x=x+1; return f end
>> foo, bar, gnu, gnat = f,f,f,f
>> foo(bar)(gnu)(gnat)
> call #0
> call #1
> call #2

So you are confusing the interpreter with the language.  Look here:

dak@lola:~$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> local x=1
> print(x)
nil

Does this tell us that in Lua local assignments end at a newline?  Of
course not.  It tells us something about how the interpreter divides its
input into separate units.

If you want to make a statement about the function of \n in the Lua
language, please write it into a complete file you feed into Lua (and
obviously not via input redirection).

-- 
David Kastrup