diff --git a/build/lua_5.2.1.h b/build/lua_5.2.1.h index db012d7870974759988776531f29873cf0bcd4c3..2849a678dba4f8e5751f685bd985190449e38db4 100644 --- a/build/lua_5.2.1.h +++ b/build/lua_5.2.1.h @@ -18,6 +18,7 @@ ** =================================================================== */ +#define LUA_COMPAT_ALL /* @@ LUA_ANSI controls the use of non-ansi features. @@ -38,8 +39,6 @@ #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ #endif - - #if defined(LUA_USE_LINUX) #define LUA_USE_POSIX #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ @@ -59,6 +58,10 @@ #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 diff --git a/examples/lua/dirscan.lp b/examples/lua/dirscan.lp new file mode 100644 index 0000000000000000000000000000000000000000..5525d2ce60d331d8784143bc7f0288049dc0b6a0 --- /dev/null +++ b/examples/lua/dirscan.lp @@ -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 +?>