Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- w, h = term.getSize()
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setCursorPos(w/2 - 4, 1)
- term.write("Grapher")
- term.setCursorPos(1, 3)
- term.write("y=")
- local input = read()
- oTemp = fs.open("_runGraph", "w")
- oTemp.writeLine("graphtab = {}")
- oTemp.writeLine("for x = 1, " .. tostring(w) .. " do")
- oTemp.writeLine(" graphtab[x] = " .. tostring(input))
- oTemp.writeLine("end")
- oTemp.flush()
- oTemp.close()
- os.loadAPI("_runGraph")
- term.setBackgroundColor(colors.black)
- term.clear()
- for i = 1, #_runGraph.graphtab - 1 do
- paintutils.drawLine(i, h - _runGraph.graphtab[i] + 1, i + 1, h - _runGraph.graphtab[i + 1] + 1, colors.green)
- term.setCursorPos(1, 1)
- end
- for i, v in pairs(_runGraph.graphtab) do
- paintutils.drawPixel(i, h - v + 1, colors.blue)
- term.setCursorPos(1, 1)
- end
- shell.run("delete _runGraph")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement