[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [S] Make table.pack error on nil values to reduce complaints
- From: "Soni L." <fakedme@...>
- Date: Tue, 26 Jul 2016 12:42:00 -0300
Make it so if table.pack is given a nil value, it errors, in order to
reduce complaints.
We already have select(). Making table.pack() error if given a nil value
will cause people to switch to select(), thus reducing complaints about
table.pack and holes.
Then, they can use something like the following, instead of complaining:
local function simplepack(...) return {n=select('#',...), ...} end
local function fancypack(...) local len = select('#', ...) return
setmetatable({...}, {__len=function() return len end}) end
This will help reduce complaints.
--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.