lua-users home
lua-l archive

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


> teste.lua
> 
> local teste0 = 'stringteste0'
> local <const> teste1 = 'stringteste1'
> local teste2 = 'stringteste2'
> local <toclose> teste3 = 'stringteste3'
> local teste4 = 'stringteste4'
> 
> lua teste.lua
> lua: teste.lua:5: attempt to close non-closable variable 'teste4'
> stack traceback:
>     teste.lua:5: in main chunk
>     [C]: in ?
> 
> Should it be 'teste3' instead of 'teste4'?

Yes.


> Am I missing something?

I don't think so. We will have a look into that.

Apparently, the problem is related to vararg functions. (A main block
is a vararg function.)

The following is wrong:

  function x (...)
    local <toclose> teste3 = 'stringteste3'
  end
  
  x()
  --> lua: temp:3: attempt to close non-closable variable '(temporary)'

The following is correct:

  function x (a)
    local <toclose> teste3 = 'stringteste3'
  end
  
  x()
  --> lua: temp:3: attempt to close non-closable variable 'teste3'

-- Roberto