Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. _G.script = [=[
  2. ++++++++++[>+++++++>++++++++++>+++>+<<<<-]
  3. >++.>+.+++++++..+++.>++.<<<<+++++++++++++++.
  4. >.+++.------.--------.>+.>.
  5. ]=]
  6. local endf = ''
  7. for i = 1, _G.script:len() do
  8. if _G.script:sub(i, i) == '+' then
  9. endf = endf..'a()\n'
  10. elseif _G.script:sub(i, i) == '-' then
  11. endf = endf..'b()\n'
  12. elseif _G.script:sub(i, i) == '>' then
  13. endf = endf..'c()\n'
  14. elseif _G.script:sub(i, i) == '<' then
  15. endf = endf..'d()\n'
  16. elseif _G.script:sub(i, i) == '.' then
  17. endf = endf..'f()\n'
  18. elseif _G.script:sub(i, i) == ',' then
  19. endf = endf..'e()\n'
  20. elseif _G.script:sub(i, i) == '[' then
  21. endf = endf..'while p[current] ~= 0 do\n'
  22. elseif _G.script:sub(i, i) == ']' then
  23. endf = endf..'end\n'
  24. end
  25. end
  26.  
  27. loadstring([[local p = {0}
  28. local current = 1
  29. local j = ''
  30. local g = ''
  31. function newbyte()
  32. p[#p+1] = 0
  33. end
  34. function k()
  35. if j == nil then return else return j end
  36. end
  37. function a()
  38. p[current] = p[current] + 1
  39. end
  40. function b()
  41. p[current] = p[current] - 1
  42. end
  43. function c()
  44. if current == #p then
  45. newbyte()
  46. current = current + 1
  47. else
  48. current = current + 1
  49. end
  50. end
  51. function d()
  52. if current ~= 1 then
  53. current = current - 1
  54. else
  55. print('\nData pointer out of range.')
  56. j = nil
  57. end
  58. end
  59. function e()
  60. p[current] = string.byte(io.read(1))
  61. end
  62. function f()
  63. if j ~= nil then
  64. io.write(string.char(p[current]))
  65. end
  66. end
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. ]]..endf..[[
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. pcall(function()
  83. for i, v in pairs(p) do
  84. if i ~= current then
  85. if i ~= #p then
  86. j = j..v..', '
  87. else
  88. j = j..v
  89. end
  90. elseif i == current then
  91. if i ~= #p then
  92. j = j..'['..v..'], '
  93. else
  94. j = j..'['..v..']'
  95. end
  96. end
  97. end
  98. j = '\n'..j
  99. end)
  100. print(k())]])()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement