[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Suggestion: Deprecate "Attempt to index a nil value" error; instead, return nil or create table
- From: "Soni \"They/Them\" L." <fakedme@...>
- Date: Fri, 28 Feb 2020 22:10:51 -0300
On 2020-02-28 10:05 p.m., Egor Skriptunoff wrote:
On Sat, Feb 29, 2020 at 12:59 AM Anton Jordaan wrote:
If I want to access the value of t[a][b][c][d][e]
I suggest that it would be more useful -- and more consistent --
if the
"Attempt to index a nil value" error is deprecated and, instead, the
indexing of undefined variables does the following:
When reading: simply return nil.
http://lua-users.org/lists/lua-l/2017-02/msg00308.html
See solution #3
When writing: automatically assign a single-entry table to each
undefined variable, with the given index the sole entry.
Creating a table would better be explicit.
mktable -p (table, a, b, c, d, e, f, g, ...).with = value
(this is valid lua fwiw, but good luck making it work :v)