lua-users home
lua-l archive

table reset

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


-- Wich version is better and why? Any suggestions are welcome.
 local Lines={}
 while true do
 local Line=Handle:read('*line')
 if Line==nil then break end
 if Line~='' then
 table.insert(Lines,Line)
 else
-- process lines here; e.g. with iterator
 Lines={}
 end
 end
 while true do
 local Lines=Lines or {}
 local Line=Handle:read('*line')
 if Line==nil then break end
 if Line~='' then
 table.insert(Lines,Line)
 else
-- process lines here; e.g. with iterator
 Lines=nil
 end
 end
-- The job is to read all lines until an empty line and
-- then process these lines and then read the next block
-- of lines until an empty line and so on...
-- Markus

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