Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local b = {}
- local l = 1
- while true do
- local command = io.read()
- if command == "l" then for k,v in pairs(b) do print(v) end
- elseif command == "lc" then print(b[l])
- elseif command == "s" then --Seek
- print">"
- l = tonumber(io.read())
- elseif command == "so" then --Output line
- print(l)
- elseif command == "a" then --Append
- print":"
- table.insert(b,l,io.read()) l = l + 1
- elseif command == "r" then --Replace
- print":"
- b[l]=io.read()
- elseif command == "d" then --Delete
- print(table.remove(b,l))
- elseif command == "o" then --Load
- print">"
- local rF = io.read()
- local f = io.open(rF,"r")
- local a=f:read()
- repeat table.insert(b,a) print(a) a=f:read("*l") until a==nil
- f:close()
- elseif command == "w" then --Save
- print">"
- local wT = io.read()
- local f = io.open(wT,"w")
- for k,v in pairs(b) do f:write(v.."\n") end f:close()
- elseif command == "e" then break else print"?" end end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement