lua-users home
lua-l archive

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


Hi list,

Why does Lua interpret something like

              (action["*"])()
          as  action["*"]()()
  and not as  action["*"]()   ?

I have checked it with "luac -l" (both in lua4.0 and in lua3.2), and
the first two expressions are compiled to:

     GETGLOBAL       0       ; action
     GETDOTTED       1       ; *
     CALL            0 1
     CALL            0 0

while the third one becomes:

     GETGLOBAL       0       ; action
     GETDOTTED       1       ; *
     CALL            0 1

This sounds a bit counterintuitive to me, and I haven't been able to
find the explanation in the manual. Also, fifteen minutes of careless
single-stepping through luaY_parser told me nothing...

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/
    http://www.mat.puc-rio.br/~edrx/
    edrx@inx.com.br