Annotation of embedaddon/axTLS/www/lua/test_lib.lua, revision 1.1.1.1
1.1 misho 1: local function getfield (t, f)
2: for w in string.gfind(f, "[%w_]+") do
3: if not t then return nil end
4: t = t[w]
5: end
6: return t
7: end
8:
9: function test_lib (libname)
10: local ok, err = pcall (require, libname)
11: if not ok then
12: cgilua.put ("Library <tt><b>"..libname.."</b></tt> not found<br>\n"..
13: err)
14: else
15: cgilua.put ("Library <tt><b>"..libname.."</b></tt><br>\n")
16: local t = getfield (_G, libname)
17: if type(t) ~= "table" then
18: cgilua.put (tostring(t))
19: else
20: for i, v in pairs (t) do
21: cgilua.put (" "..tostring(i).." = "..tostring(v).."<br>\n")
22: end
23: end
24: end
25: cgilua.put ("\n<p>\n")
26: end
27:
28: cgilua.htmlheader ()
29: for _, lib in ipairs { "lfs", "socket", "luasql.postgres", "luasql", "lxp", "lxp.lom", "lualdap", "htk", "xmlrpc", "xmlrpc.http" } do
30: test_lib (lib)
31: end
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>