From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001
From: Daniel Baumann This is another example of a Lua server page, served by
+CivetWeb web server.
+
+The following features are available:
+
+]])
+
+function print_if_available(tab, name)
+ if tab then
+ mg.write("
\n")
+ for k,v in pairs(tab) do
+ if type(v) == "table" then
+ mg.write("
\n")
+end
+
+-- Print Lua version and available libraries
+mg.write("\n")
+libs = {"string", "math", "table", "io", "os", "bit32", "utf8", "package", "coroutine", "debug"};
+for _,n in ipairs(libs) do
+ print_if_available(_G[n], n);
+end
+mg.write("
\n")
+print_if_available(sqlite3, "sqlite3 binding")
+print_if_available(lfs, "lua file system")
+
+--recurse(_G)
+
+-- Print mg library
+libname = "mg"
+print_if_available(_G[libname], libname .. " library")
+recurse(_G[libname])
+
+-- Print connect function
+print_if_available(connect, "connect function")
+
+-- Get all server options
+mg.write("
Today is " .. os.date("%A") .. "
\n"); + +l = mg.request_info.content_length +if l then + mg.write("Content-Length = "..l..":
\n
\n") + mg.write(mg.read()) + mg.write("\n\n\n") +end + +mg.write("
\n"); + + if lfs then + mg.write("Files in " .. lfs.currentdir()) + mg.write("\n