mad1231999

Untitled

Jan 14th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. function flib.getOS()
  2.    return (os.getenv("HOME") == nil and "windows" or "unix")
  3. end
  4.  
  5. function flib.getFiles(directory)
  6.    if fs ~= nil then
  7.       return fs.list(directory)
  8.    else
  9.       local i, t, popen = 0, {}, io.popen
  10.      
  11.       for filename in popen((flib.getOS() == "unix" and ('ls -a "' .. directory .. '"') or ('dir "' .. directory .. '" /b /ad'))):lines() do -- LINE 205
  12.          i = i + 1
  13.          t[i] = filename
  14.       end
  15.      
  16.       return t
  17.    end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment