Advertisement
john9912

Frame.c build on Frame.b

Feb 22nd, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. os.loadApi("Frame.b")
  2. c = {}
  3. c.t = {}
  4. c.c = {}
  5. c.b = {}
  6. MaxX,MaxY = 51,19
  7. local function tT(x,y)
  8.    if x < 100 then
  9.       local a = "0"..x
  10.    elseif x < 10 then
  11.       local a = "00"..x
  12.    else
  13.       local a = x
  14.    end
  15.    if y < 100 then
  16.       a = a.."0"..x
  17.    elseif y < 10 then
  18.       a = a.."00"..x
  19.    else
  20.       a = a..x
  21.    end
  22.    return a
  23. end
  24. function import(x,y)
  25.    Frame.b.exportString(x,y)
  26.    c.t[tT(x,y)] = istring:sub(1)
  27.    c.c[tT(x,y)] = istring:sub(2)
  28.    c.b[tT(x,y)] = istring:sub(3)
  29.    istring = nil
  30. end
  31. function importArea(x1,y1,x2,y2)
  32.    if x1 > 0 and x1 < x2 and y1 < 0 and y1 < y2 and x2 < MaxX and y2 < MaxY then
  33.       while y1 < y2 + 1 do
  34.          while x1 < x2 + 1 do
  35.             import(x1,y1)
  36.             x1 = x1 + 1
  37.          end
  38.          y1 = y1 + 1
  39.       end
  40.    else
  41.       error("ivalid range")
  42.    end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement