Re: Empty Table Manipulation
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Empty Table Manipulation
- From: Luis Carvalho <carvalho@...>
- Date: 2006年4月20日 16:53:50 -0400
> if ((not disp) or (table.getn(disp)==0)) then
> do stuff
> end
in Lua 5.1 becomes
if not disp or not next(disp) then
-- do stuff
end
and
> for i,d in disp do
> do things
> end
becomes
for i,d in pairs(disp) do
-- do stuff
end
or
for i,d in next, disp do
-- do stuff
end
Cheers,
luis.
--
A mathematician is a device for turning coffee into theorems.
-- P. Erdos
--
Luis Carvalho
Applied Math PhD Student - Brown University
PGP Key: E820854A <carvalho@dam.brown.edu>