Files
cpp-project-template/third_party/prometheus/3rdparty/civetweb/test/page2.lp
tqcq c68893bace
Some checks failed
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Failing after 29s
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Failing after 16s
sm-rpc / build (Debug, host.gcc) (push) Failing after 11s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Failing after 12s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Failing after 11s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Failing after 11s
sm-rpc / build (Release, host.gcc) (push) Failing after 12s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Failing after 16s
feat add spdlog
2025-08-22 18:22:57 +08:00

73 lines
1.8 KiB
Plaintext

<? mg.write("HTTP/1.0 200 OK") ?>
<? mg.write("Content-Type: text/html") ?>
<html><body>
<p>This is another example of a Lua server page, served by
<a href="https://github.com/civetweb/civetweb">CivetWeb web server</a>.
</p><p>
The following features are available:
<ul>
<?
-- functions defubed in one Lua tag should still be available in the next one
function print_if_available(tab, name)
if tab then
mg.write("<li>" .. name .. "</li>\n")
end
end
function recurse(tab)
mg.write("<ul>\n")
for k,v in pairs(tab) do
if type(v) == "table" then
mg.write("<li>" .. tostring(k) .. ":</li>\n")
recurse(v)
else
mg.write("<li>" .. tostring(k) .. " = " .. tostring(v) .. "</li>\n")
end
end
mg.write("</ul>\n")
end
?>
<?
-- Print Lua version and available libraries
mg.write("<li>" .. _VERSION .. " with the following standard libraries</li>\n")
mg.write("<ul>")
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("</ul>\n")
print_if_available(sqlite3, "sqlite3 binding")
print_if_available(lfs,"lua file system")
-- Print mg library
libname = "mg"
print_if_available(_G[libname], libname .. " library")
recurse(_G[libname])
-- Print connect function
print_if_available(connect, "connect function")
?>
</ul></p>
<p> Today is <? mg.write(os.date("%A")) ?>
<p>
<?
-- for k,v in pairs(_G) do mg.write(k, '\n') end
if lfs then
mg.write("Files in " .. lfs.currentdir())
mg.write("\n<ul>\n")
for f in lfs.dir(".") do
mg.write("<li>" .. f .. "</li>\n")
local at = lfs.attributes(f);
recurse(at)
end
mg.write("</ul>\n")
end
?>
</p>
</body></html>