lua-users home
lua-l archive

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


2011/11/11 Procházka Lukáš Ing. - Pontex s. r. o. <LPr@pontex.cz>:
>  Lua 5.2.0 (beta)  Copyright (C) 1994-2011 Lua.org, PUC-Rio
> > local f1  [...]
> > print(f1())
>  stdin:1: attempt to call global 'f1' (a nil value)

When using locals in the interpreter, surround the entire code with a
do/end block.  Observe:

  Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
  > local x=1
  > print(x)
  nil
  > do
  >> local x=1
  >> print(x)
  >> end
  1