lua-users home
lua-l archive

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


2015-08-18 19:14 GMT+02:00 Soni L. <fakedme@gmail.com>:

> I'd like a way to do
>
> local v
> do v = 3 end
>
> without assigning nil to v.

You can't have that in principle. No name can ever not be
associated to a value. If you don't do

local v=3

(why on earth don't you?) then Lua explicitly supplies the nil.
Otherwise that slot would contain whatever was in it before
(which may be a user's unencrypted password) and all sorts
of security holes open up.