lua-users home
lua-l archive

Re: Size of a non numerical indexed table

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


I'm fairly certain it was an interaction with varargs - attempts to iterate over the arguments failed because the iterators stopped whenever they encountered a nil argument.
the ipairs generator will stop at the first nil. To safely iterate over all arguments use:
 for i = 1, select("#", ...) do
	local a = select(i, ...)
 -- etc...
 end
or
 local arg = {...}
 for i = 1, select("#", ...) do
	local a = arg[i]
 -- etc...
 end
--
Wim

AltStyle によって変換されたページ (->オリジナル) /