-: , nil +, files ( error). , assert, " ".
files, - (function() end) error .
:
local function dummy_iter() end
function iterpcall( g, ... )
local ok, f, st, var = pcall( g, ... )
if ok then
return f, st, var
else
return dummy_iter
end
end
for file in iterpcall( files, "/path/to/folder" ) do
print( file )
for line in iterpcall( io.lines, file ) do
print( line )
end
end
iterpcall , (files io.lines), (f). f pcall, .