Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local t = {}
- local c = {}
- local b = {}
- setting = {}
- setting.useColor = true
- setting.format = "normal" --"normal" = xxyy "large" = xxxyyy
- setting.useGetSize = true
- setting.MaxX = 51
- setting.MaxY = 19
- local function tT(x,y)
- if setting.format == "large" then
- if x < 10 then
- local a = "00"..x
- elseif x < 100 then
- local a = "0"..x
- else
- local a = x
- end
- if y < 10 then
- a = a.."00"..y
- elseif y < 100 then
- a = a.."0"..y
- else
- a = a..y
- end
- elseif setting.format == "normal" then
- if x < 10 then
- local a = "0"..x
- else
- local a = x
- end
- if y < 10 then
- a = a.."0"..y
- else
- a = a..y
- end
- else
- error("incorrect format")
- end
- return a
- end
- function sett(x,y,char)
- t[tT(x,y)] = char
- end
- function setc(x,y,color)
- c[tT(x,y)] = color
- end
- function setb(x,y,color)
- b[tT(x,y)] = color
- end
- function gett(x,y)
- return t[tT(x,y)]
- end
- function getc(x,y)
- return c[tT(x,y)]
- end
- function getb(x,y)
- return b[tT(x,y)]
- end
- function init()
- if setting.useGetSize == true then
- MaxX, MaxY = term.getSize()
- end
- local Y = 1
- while Y < MaxY do
- local X = 1
- while X < MaxX do
- sett(X,Y," ")
- setc(X,Y,"0")
- setb(X,Y,"f")
- X = X + 1
- end
- Y = Y + 1
- end
- return true
- end
- function setText(x,y,text)
- if y > 0 and y < MaxY+1 and x > 0 and x < MaxX+1 and string.len(text) + x < MaxX+1 then
- local a = string.len(text)
- while not a == 0 do
- sett(x,y,text:sub(string.len(text)-a+1)
- a = a - 1
- x = x + 1
- end
- end
- end
- function setBkg(color)
- local y = 1
- while y < MaxY + 1 do
- local x = 1
- while x < MaxX + 1 do
- setb(x,y,color)
- x = x + 1
- end
- y = y + 1
- end
- end
- function setCol(color)
- local y = 1
- while y < MaxY + 1 do
- local x = 1
- while x < MaxX + 1 do
- setc(x,y,color)
- x = x + 1
- end
- y = y + 1
- end
- end
- function export(x,y)
- local a = tT(x,y)
- return t[a]..c[a]..b[a]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement