NewWars 875 Posted July 25, 2015 Boas Pessoal. Como ja não posto algo faz quase 1 mes se não mais, aqui vai algo simples mas util function ListDirectory(dir, mask) local files = {} local tmpfile = '/tmp/'..pc.get_name()..'.ld' os.execute('ls -1 '..dir..' > '..tmpfile) local f = io.open(tmpfile) if not f then return files end local k = 1 for line in f:lines() do if mask == "" or mask == nil then files[k] = line k = k + 1 elseif string.find(line,"%."..mask.."$") then files[k] = line k = k + 1 end end f:close() return files end Como usar? local files = ListDirectory('/usr/home/game/share/locale/germany/', "lua") --DIRECTORICA, MASK for i=1,table.getn(files) do say(""..files[i]) end Cumprimentos. 4 nagatto, xXBoyDarkXx, Nestle and 1 other reacted to this Share this post Link to post Share on other sites
Tyler Durden 556 Posted July 25, 2015 Como ja não posto algo faz quase 1 mes se não mais, aqui vai algo simples mas util Estás à vontade, posta quando quiseres. Nós agradecemos. :like: Share this post Link to post Share on other sites