Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chars = "0123456789abcdefghijklmnopqrstuvwxyz.,-!?+*<>#@$ۤ%&/()[]"
- local msg = ""
- local pointer = 1
- local commands = {
- ["eat"] = function()
- pointer = pointer+1
- if(pointer > #chars) then pointer = 1 end
- end,
- ["puke"] = function()
- pointer = pointer-1
- if(pointer < 1) then pointer = #chars end
- end,
- ["poop"] = function()
- msg = msg..chars:sub(pointer,pointer)
- end,
- ["POOP"] = function()
- msg = msg..chars:sub(pointer,pointer):upper()
- end,
- ["sniff"] = function()
- write(msg.." ")
- end,
- ["flush"] = function()
- msg = ""
- pointer = 1
- end
- }
- local args = {...}
- if(#args < 1) then error("I need more arguments.",0) end
- if(not fs.exists(args[1])) then error("File not found",0) end
- local handle = fs.open(args[1],"r")
- local content = handle.readAll()
- handle.close()
- content = content:gsub("\n"," ")
- for word in content:gmatch("[^ \t]+") do
- commands[word]()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement