-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuildreadme.lua
More file actions
29 lines (26 loc) · 820 Bytes
/
Copy pathbuildreadme.lua
File metadata and controls
29 lines (26 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- Open the file LibSerialize.lua in read mode
local from = io.open("LibSerialize.lua", "r")
-- Open the file README.md in write mode
local to = io.open("README.md", "w")
if from and to then
local writeMode = false
-- Read each line of `from`
for line in from:lines() do
if line == "--[[ BEGIN_README" then
-- Start writing after this line
writeMode = true
elseif line == "END_README --]]" then
-- Stop writing after this line
writeMode = false
elseif writeMode then
-- Write the content between BEGIN_README and END_README to `to`
to:write(line .. "\n")
end
end
-- Close both files
from:close()
to:close()
print("Generated README.md!")
else
error("Could not open files!")
end