Commit 74711c68 authored by Sergey Lyubka's avatar Sergey Lyubka

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

parent 78c994f7
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
** =================================================================== ** ===================================================================
*/ */
#define LUA_COMPAT_ALL
/* /*
@@ LUA_ANSI controls the use of non-ansi features. @@ LUA_ANSI controls the use of non-ansi features.
...@@ -38,8 +39,6 @@ ...@@ -38,8 +39,6 @@
#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
#endif #endif
#if defined(LUA_USE_LINUX) #if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX #define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
...@@ -59,6 +58,10 @@ ...@@ -59,6 +58,10 @@
#endif #endif
#if defined(__posix) || defined(__linux) || \
defined(__unix) || defined(__APPLE__)
#define LUA_USE_POSIX
#endif
/* /*
@@ LUA_USE_POSIX includes all functionality listed as X/Open System @@ LUA_USE_POSIX includes all functionality listed as X/Open System
......
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
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment