lua-users home
lua-l archive

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


Le sam. 29 juin 2019 à 21:11, Soni "They/Them" L. <fakedme@gmail.com> a écrit :
>
> There's nothing unsafe about "unset" because it's exactly equivalent to
> renaming your (local) variables.


If you unset a variable to get the effect of hiding it completely and get access to the homonymous variable from an outer scope, and then modifying it, it is unsafe.

This does not happen when you redeclare a local variable that makes the previous one out of scope and unreachable. As well when you set that variable to nil this does not alow the homonymous variable from a previous scope to become accessible.

Really, "unset" is not needed and dangerous. Just use "local" instead.