diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2022-06-19 19:47:51 +0530 |
|---|---|---|
| committer | Raghuram Subramani <raghus2247@gmail.com> | 2022-06-19 19:47:51 +0530 |
| commit | 4fd287655a72b9aea14cdac715ad5b90ed082ed2 (patch) | |
| tree | 65d393bc0e699dd12d05b29ba568e04cea666207 /circuitpython/lib/axtls/www/lua/test_lib.lua | |
| parent | 0150f70ce9c39e9e6dd878766c0620c85e47bed0 (diff) | |
add circuitpython code
Diffstat (limited to 'circuitpython/lib/axtls/www/lua/test_lib.lua')
| -rw-r--r-- | circuitpython/lib/axtls/www/lua/test_lib.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/circuitpython/lib/axtls/www/lua/test_lib.lua b/circuitpython/lib/axtls/www/lua/test_lib.lua new file mode 100644 index 0000000..5041253 --- /dev/null +++ b/circuitpython/lib/axtls/www/lua/test_lib.lua @@ -0,0 +1,31 @@ +local function getfield (t, f) + for w in string.gfind(f, "[%w_]+") do + if not t then return nil end + t = t[w] + end + return t +end + +function test_lib (libname) + local ok, err = pcall (require, libname) + if not ok then + cgilua.put ("Library <tt><b>"..libname.."</b></tt> not found<br>\n".. + err) + else + cgilua.put ("Library <tt><b>"..libname.."</b></tt><br>\n") + local t = getfield (_G, libname) + if type(t) ~= "table" then + cgilua.put (tostring(t)) + else + for i, v in pairs (t) do + cgilua.put (" "..tostring(i).." = "..tostring(v).."<br>\n") + end + end + end + cgilua.put ("\n<p>\n") +end + +cgilua.htmlheader () +for _, lib in ipairs { "lfs", "socket", "luasql.postgres", "luasql", "lxp", "lxp.lom", "lualdap", "htk", "xmlrpc", "xmlrpc.http" } do + test_lib (lib) +end |
