[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Undefined variables returning nil
- From: Geoff Leyland <geoff_leyland@...>
- Date: Wed, 20 Mar 2013 11:43:17 +1300
On 20/03/2013, at 11:32 AM, William Sumner <prestonsumner@me.com> wrote:
> I know Lua only has tables. Because they're used for arrays, classes, and more, catching only undefined globals is insufficient. I'm suggesting that, unless there's a good reason for the current behavior that I'm unaware of, relying on user-implemented solutions is undesirable and that the language should raise an error because the current default behavior is unsafe.
Please, no. "if table[key] then something() end" works. Otherwise we'd have to invent new syntax to check whether keys existed.
Giving the user enough rope to implement solutions to their particular problems is a big part of what makes Lua what it is: relying on user-implemented solutions *is* desirable.