Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- xXm0dzXx Default Programming API ---
- -- All my programs will have this :DD --
- ----------------------------------------
- local x,y = term.getSize()
- local function cPrint( txt ) --Version 2.0 of cPrint
- local function printC( text )
- x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- write(text.. "\n")
- end
- if type(txt) == "string" then
- printC( txt )
- elseif type(txt) == "table" then
- for i=1,#txt do
- printC( txt[i] )
- end
- end
- end
- local drawingBoard = {
- ["A"] = colors.white,
- ["B"] = colors.orange,
- ["C"] = colors.magenta,
- ["D"] = colors.lightBlue,
- ["E"] = colors.yellow,
- ["F"] = colors.lime,
- ["G"] = colors.pink,
- ["H"] = colors.gray,
- ["I"] = colors.lightGray,
- ["J"] = colors.cyan,
- ["K"] = colors.purple,
- ["L"] = colors.blue,
- ["M"] = colors.brown,
- ["N"] = colors.green,
- ["O"] = colors.red,
- ["P"] = colors.black,
- }
- local function advWrite( pos1, pos2, str )
- for i=1,#str do
- local symb = drawingBoard[ string.sub( str, i, i) ]
- term.setCursorPos( pos1 + (i-1) , pos2 )
- if symb then
- term.setBackgroundColour( symb )
- write(" ")
- end
- end
- end
- local function setBG( col, colz )
- term.setBackgroundColour( col )
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColour( colz )
- end
- local function getLines( path )
- local tLines = {}
- local file = fs.open( path, "r" )
- if file then
- line = file.readLine()
- while line do
- tLines[ #tLines+1 ] = line
- line = file.readLine()
- end
- file.close()
- end
- return tLines
- end
- -- End of API --
Advertisement
Add Comment
Please, Sign In to add comment