lua-users home
lua-l archive

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


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.