Added directory scanning example, and enabled posix routines in Lua for unix environment

This commit is contained in:
Sergey Lyubka committed 2013-11-23 13:58:27 +00:00
1 parent 78c994f7cc
commit 74711c686f
2 files changed
+20 -2

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
HTTP/1.0 200 OK
Content-Type: text/plain
<?
-- Directory scanning example
function scandir(dir)
local t = {}
for f in io.popen('dir ' .. dir):lines() do table.insert(t, f) end
return t
end
local tab = scandir('C:\\')
for k,v in pairs(tab) do mg.write(v, '\n') end
?>