xXm0dzXx

Untitled

Nov 4th, 2012
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. local tArgs = {...}
  2.  
  3. print("ByteFawk Simulator")
  4. local tLines = {}
  5.  
  6. if tArgs[1] then
  7. file = fs.open(tArgs[1], "r")
  8. if file then
  9. local line = file.readLine()
  10. while line do
  11. tLines[#tLines+1] = line
  12. line = file.readLine()
  13. end
  14. end
  15. else
  16. print("Workspace:")
  17.  
  18. while true do
  19. local line = read()
  20. if line ~= "~ end" then
  21. tLines[#tLines+1] = line
  22. else
  23. break
  24. end
  25. end
  26. end
  27.  
  28. for i=1,#tLines do
  29. local tWords = {}
  30. for match in string.gmatch(tLines[i], "[^ \t]+") do
  31. table.insert( tWords, match )
  32. end
  33.  
  34. local lineType = tWords[1]
  35. local variableType = tWords[2]
  36. local bitez = tWords[3]
  37.  
  38. if lineType == "-" then
  39. if variableType == ">" then
  40. write( string.char( tonumber(bitez) ) )
  41. elseif variableType == "<" then
  42. write( string.char( bitez ) )
  43. end
  44. elseif lineType == "=" then
  45. print()
  46. end
  47. end
  48.  
  49. --Example--
  50. --[[
  51.  
  52. = < 558
  53. - > 72
  54. - > 101
  55. - > 108
  56. - > 108
  57. - > 111
  58. - > 32
  59. - > 87
  60. - > 111
  61. - > 114
  62. - > 108
  63. - > 100
  64. = > 491
  65.  
  66. --]]
Advertisement
Add Comment
Please, Sign In to add comment