lua-users home
lua-l archive

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


> 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>