From 4fd287655a72b9aea14cdac715ad5b90ed082ed2 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Sun, 19 Jun 2022 19:47:51 +0530 Subject: add circuitpython code --- circuitpython/lib/axtls/www/lua/test_fs.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 circuitpython/lib/axtls/www/lua/test_fs.lua (limited to 'circuitpython/lib/axtls/www/lua/test_fs.lua') diff --git a/circuitpython/lib/axtls/www/lua/test_fs.lua b/circuitpython/lib/axtls/www/lua/test_fs.lua new file mode 100644 index 0000000..566ed8b --- /dev/null +++ b/circuitpython/lib/axtls/www/lua/test_fs.lua @@ -0,0 +1,23 @@ +function link_dir (dir, base) + local path = base.."/"..dir + local mode = lfs.attributes (path).mode + if mode == "directory" then + return string.format ('%s', + cgilua.mkurlpath ("test_fs.lua", { dir = path }), + dir) + else + return dir + end +end + +cgilua.htmlheader () +cgilua.put ("

Testing Filesystem library

\n") +cgilua.put ("\n") +cgilua.put ("\n") +local i = 0 +local dir = cgi.dir or "." +for file in lfs.dir (dir) do + i = i+1 + cgilua.put ("\n") +end +cgilua.put ("
Testing dir
"..i..""..link_dir(file, dir).."
\n") -- cgit v1.2.3