Annotation of embedaddon/axTLS/www/lua/overview.lp, revision 1.1
1.1 ! misho 1: <?lua
! 2: -- Tries to load known libraries
! 3: for _, t in ipairs { "lxp", "luasql.postgres", "luasql.mysql", "luasql.oci8", "luasql.sqlite", "luasql.odbc", "socket", "xmlrpc", "soap", "lualdap", "logging", "md5", "zip", "stable", "copas", } do
! 4: pcall (require, t)
! 5: end
! 6:
! 7: libraries = { "lxp", "luasql", "socket", "xmlrpc", "soap", "lualdap", "logging", "md5", "zip", "stable", "copas", }
! 8:
! 9: local colors = { "#999999", "#CCCCCC", "#FFFFFF", }
! 10: local i = 0
! 11: function color () i = math.mod (i + 1, 3) return colors[i + 1] end
! 12:
! 13: function pack_name (p) return string.gsub (p, "^([^.]+).-", "%1") end
! 14:
! 15: function idx (t, f) return _G[t][f] or _G[t]["_"..f] or "" end
! 16: ?>
! 17: <html>
! 18: <head><title>CGILua installation overview</title></head>
! 19:
! 20: <body bgcolor="#FFFFFF">
! 21: <h1>CGILua installation overview</h1>
! 22:
! 23: <table>
! 24: <tr>
! 25: <th bgcolor="#999999">Version
! 26: <th bgcolor="#999999">Copyright
! 27: <th bgcolor="#999999">Description
! 28: </tr>
! 29: <?lua
! 30: local support = {
! 31: { "Lua", "_VERSION" },
! 32: { "compat-5.1", "_COMPAT51" },
! 33: }
! 34: for _, l in ipairs (support) do bg = color()
! 35: ?>
! 36: <tr>
! 37: <td bgcolor = "<%= bg %>"><%= tostring(_G[l[2]]) %>
! 38: <td bgcolor = "<%= bg %>">
! 39: <td bgcolor = "<%= bg %>">
! 40: </tr>
! 41: <? end ?>
! 42: <tr><td colspan="4"></tr>
! 43: <?lua
! 44: local pack = {}
! 45: for i, p in ipairs (libraries) do
! 46: local s = _G[p]
! 47: local n = pack_name(p)
! 48: if type(_G[n]) == "table" and _G[n]._VERSION then
! 49: pack[n] = true
! 50: table.insert (pack, n)
! 51: end
! 52: end
! 53: table.sort (pack)
! 54: for _, p in ipairs (pack) do bg = color() ?>
! 55: <tr>
! 56: <td bgcolor = "<%= bg %>"><%= idx(p,"VERSION") %>
! 57: <td bgcolor = "<%= bg %>"><small><%= idx(p,"COPYRIGHT") %></small>
! 58: <td bgcolor = "<%= bg %>"><small><%= idx(p,"DESCRIPTION") %></small>
! 59: </tr>
! 60: <?lua end ?>
! 61: </table>
! 62:
! 63: </body>
! 64: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>