Compare commits
2 Commits
main
...
development
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b31f680be | |||
| 9c453d1f2e |
@@ -39,3 +39,6 @@ luac.out
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Testing Fİles
|
||||
testing/
|
||||
testing/*
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
local lfs = require("lfs")
|
||||
|
||||
-- list of markdown files in working directory
|
||||
local markdownFiles = {}
|
||||
|
||||
-- amount of markdown files in working directory
|
||||
local markdownFileCount = 0
|
||||
local currentDir = lfs.currentdir()
|
||||
for file in lfs.dir(currentDir) do
|
||||
-- ignore "." and ".." files
|
||||
if not(file:sub(1,3) == ".." or file:sub(1,2) == '.') then
|
||||
local filePath = currentDir .. '/' .. file
|
||||
-- match file names ending with ".md"
|
||||
if file:match("%.md$") then
|
||||
markdownFileCount = markdownFileCount + 1
|
||||
markdownFiles[markdownFileCount] = filePath
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for index, value in ipairs(markdownFiles) do
|
||||
-- print file path with index
|
||||
print(index .. ': ' .. markdownFiles[index])
|
||||
local f = io.open(markdownFiles[index], 'r')
|
||||
if f then
|
||||
local content = f:read("*all")
|
||||
f:close()
|
||||
-- print file content
|
||||
print(content)
|
||||
else
|
||||
print("can't read the file ".. markdownFiles[index])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user