Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- qs = ""
- ANSWERS = {""}
- OPENS = false
- cfgn = "/questions"
- fs = require("filesystem")
- --while true do
- function unstd()
- for h=1,200,1 do
- ms = fl:read()
- if ms == nil then
- break
- else
- if ms == "{" then
- OPENS = true
- for i=1,10,1 do
- --print(i)
- ms = fl:read()
- --print(ms)
- if string.sub(ms,1,1) == "#" then
- cmd = string.sub(ms,2)
- if string.sub(cmd,1,3) == "QS:" then
- qs = string.sub(cmd,4)
- --print("QS="..qs)
- ms = fl:read()
- --print(ms)
- elseif string.sub(cmd,1,3) == "A1:" then
- table.insert(ANSWERS,string.sub(cmd,4))
- NQ = 2
- for j=1,10,1 do
- if NQ == 4 then
- break end
- ms = fl:read()
- if string.sub(ms,1,1) == "#" then
- cmd = string.sub(ms,2)
- if string.sub(cmd,1,3) == "A"..tostring(NQ)..":" then
- NQ = NQ + 1
- table.insert(ANSWERS,string.sub(cmd,4))
- end
- end
- end
- end
- if ms == "}" then
- OPENS = false
- --print("breaked")
- break
- end
- end
- if OPENS then
- print("not closed question!")
- OPENS = false
- --else
- end
- print(qs)
- for i=1,#ANSWERS do
- print(ANSWERS[i])
- end
- --end
- end
- end
- end
- end
- end
- if fs.exists(cfgn) then
- if not fs.isDirectory(cfgn) then
- fl = io.open(cfgn,"r")
- unstd()
- else
- fl = io.open(cfgn,"w")
- fl:close()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment