Advertisement
ComputerMan123

HouseScript

Nov 25th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. --[[
  2. HouseScript by houseofkraft
  3. ]]--
  4.  
  5. -- This is a entirely new programming language for ComputerCraft
  6.  
  7. local args = { ... }
  8.  
  9. local vars = {}
  10. if args[1] == "-hs" then
  11. if #args < 2 then
  12. printError("Usage: housescript -hs <file>")
  13. error()
  14. end
  15. local f = args[2]
  16. file = fs.open(f, "r")
  17. local lines = 0
  18. while file.readLine() do
  19. lines = lines + 1
  20. end
  21. file.close()
  22. file = fs.open(f, "r")
  23. for k = 1, #lines do
  24. v = file.readLine()
  25. if v:find("sys.print()") then
  26. if v == "sys.print(" then
  27. printError(shell.getRunningProgram()..": "..tostring(k)..": ) expected, (to close sys.print on line "..tostring(k)..")")
  28. error()
  29. elseif v == "sys.print)" then
  30. printError(shell.getRunningProgram()..": "..tostring(k)..": expected ()")
  31. error()
  32. end
  33. local s = v:gsub("sys.print(", "")
  34. s = s:sub(2, #s - 1)
  35. s = s:gsub('"', '')
  36. print(tostring(s))
  37. elseif v == "sys.shutdown()" then
  38. os.shutdown()
  39. elseif v == "io.clear()" then
  40. term.clear()
  41. elseif v == "sys.reboot()" then
  42. os.reboot()
  43. elseif v:find("**") then
  44. -- Comment symbol, do nothing
  45. end
  46. end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement