lua-users home
lua-l archive

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


Gyepi SAM <self-lua@gyepi.com> [2010-10-03 18:54:43]:

> On Sun, Oct 03, 2010 at 10:24:10AM +0200, Petr Štetiar wrote:
> > 
> > I think, that just the table is enough.
> 
> Like this?
> 
> cat <<EOS | luac -o data.luac -
> { "one", "two", "three" }
> EOS
> 
> Doesn't work. The table is an expression and lua expects a statement.
> The 'return' is necessary to make the line a statement and to return the data.

Sorry, overlooked it. I've meant table assigned to variable, somethin like
this:

ynezz@wizard:~$ cat test.lua
t = { "one", "two" }
ynezz@wizard:~$ luac -l test.lua

main <test.lua:0,0> (6 instructions, 24 bytes at 0x8060d10)
0+ params, 3 slots, 0 upvalues, 0 locals, 3 constants, 0 functions
        1       [1]     NEWTABLE        0 2 0
        2       [1]     LOADK           1 -2    ; "one"
        3       [1]     LOADK           2 -3    ; "two"
        4       [1]     SETLIST         0 2 1   ; 1
        5       [1]     SETGLOBAL       0 -1    ; t
        6       [1]     RETURN          0 1

-- ynezz