Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tGetPos = term.getCursorPos
- tB = term.setBackgroundColor
- tT = term.setTextColor
- clear = term.clear
- tSize = term.getSize
- run = shell.run
- RunningProgram = shell.getRunningProgram
- function tPos(x,y)
- local x = x or 1
- local y = y or 1
- term.setCursorPos(x,y)
- end
- function clearL(pos)
- local pos = pos or tGetPos()
- tPos(1,pos)
- term.clearLine()
- end
- function wall( char, line, color)
- if color ~= nil then tT(color) end
- local line = line or 1
- tPos(1,line)
- print(char)
- tPos(51,line)
- print(char)
- end
- function pixWall(line, color)
- local line = line or 1
- color = color or white
- paintutils.drawPixel(1,line, color)
- paintutils.drawPixel(51,line, color)
- end
- function Ln(x)
- local x = x or 1
- for i=1,x, 1 do
- print()
- end
- end
- function printLine( text, color)
- if color ~= nil then tT(color) end
- print()
- print(text)
- end
- function printLn( text, color)
- if color ~= nil then tT(color) end
- print()
- print( text )
- end
- function printC( text, color )
- tT(color)
- print( text )
- end
- function writeC( text, color )
- tT(color)
- write( text )
- end
- function getInput( x, y, char)
- local char = char or nil
- tPos(x,y)
- return read(char)
- end
- function TextLine( line , color)
- if color ~= nil then tT(color) end
- tPos(1,line)
- print("+-------------------------------------------------+")
- end
- function drawImage( img, y, x)
- if not fs.exists(img) then error("File " ..img.. " does not exist.") end
- local x = x or 1
- local y = y or 1
- local img = paintutils.loadImage(img)
- paintutils.drawImage(img, y, x)
- end
- function printCentered( text, line, color)
- if color ~= nil then tT(color) end
- local w, h = term.getSize()
- local x = math.floor((w - string.len( text )) / 2)
- tPos(x,line)
- print(text)
- end
- function require(file)
- if not fs.exists(file) then printC("Required file not exists!", red) end
- end
- function wFile(path, text)
- local file = assert(io.open(path, "w"))
- file:write(text)
- file:close()
- end
- function download(adress, save)
- http.get(adress)
- local desc = http.get(adress)
- local file = fs.open(save, "w")
- file.write(desc.readAll())
- file.close()
- end
- function getDir()
- local getDir = shell.dir()
- if getDir == "" then return "/"
- elseif getDir ~= "" then return getDir end
- end
- function cdPath(dir)
- if dir == nil then
- return getDir()
- elseif dir ~= nil then
- shell.run("cd ", dir)
- end
- end
- function createDir(name)
- if name ~= nil then
- shell.run("mkdir ", name)
- elseif name == nil then
- error("createDir: name expected")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment