[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0
- From: Michael Nelson <mikestar1313@...>
- Date: Fri, 15 Jul 2016 13:54:00 -0700
For me, this thread is just making tables too complicated. For tables I
create in code, problems with nil easy to program around. For table
operations on arbitrary data:
local fakenil=(}
function nilin(val)
if val==nil then val=fakenil end
return val
end
function nilout(val)
if val==fakenil then val=nil end
return val
end
Use these functions in conjunction with table.insert ...., and # works
fine on tables with with no holes. If you really need sparse arrays, it
would be more complicated--but I have no need. Perhaps someone could
make a sparse array library using userdata? I would use that if I needed
it. Who has any problem using lfs if they need file operations more
complex than the io library provides? But lfs is not part of the Lua
core, nor is it a standard library. The same could happen with a well
written sparse array library. They only thing I might like to see
changed in the table library is to make table.pack and table.unpack
symmetric, as has been discussed upthread.
-- Mike
- References:
- Request for 5.4: adding [] as table creation syntax for Lua 6.0, Reed Weichler
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Luiz Henrique de Figueiredo
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Rena
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Egor Skriptunoff
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Daurnimator
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Egor Skriptunoff
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Philipp Janda
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Egor Skriptunoff
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Soni L.
- Re: Request for 5.4: adding [] as table creation syntax for Lua 6.0, Patrick Donnelly