lua-users home
lua-l archive

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


2015-04-17 11:16 GMT+02:00  <klaas.decanniere@telenet.be>:

> local z={}
> z.z = {}
>
> does not work
>
> stdin:1: attempt to index global 'z' (a nil value)
> stack traceback:
>         stdin:1: in main chunk
>         [C]: ?
>
> What is happening?

In an interactive Lua session, local variables are local to
the line of code unless they are in an unclosed block.
I.e.

local z={}; z.z = {}

should work.