Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function getLines(dir)
- local data = {}
- local cur = 1
- local file = fs.open(dir, "r")
- local line = file.readLine()
- while line ~= nil do
- data[cur] = line
- cur = cur + 1
- line = file.readLine()
- sleep(0)
- end
- file.close()
- return data
- end
- local function getFrames(dir)
- local dataf = {}
- local cur = 1
- local curdir = dir.."frame"..(cur-1)..".frm"
- while fs.exists(curdir) do
- dataf[cur] = getLines(curdir)
- cur = cur + 1
- curdir = dir.."frame"..(cur-1)..".frm"
- end
- return dataf
- end
- local function getTableSize(table)
- local cur = 0
- for i,v in ipairs(table) do
- cur = i
- end
- return cur
- end
- function setUp()
- fs.makeDir("CCAni")
- end
- local looper = true
- function stopLoop()
- looper = false
- end
- function runFrame(frame)
- for i,v in ipairs(frame) do
- local line = v
- print(line)
- end
- end
- function runAnimation(name, pause, loop)
- local frames = getFrames("CCAni/"..name.."/")
- local x = 1
- local sz = getTableSize(frames)
- local j = 1
- for j=1,loop,1 do
- for x=1,sz,1 do
- term.clear()
- term.setCursorPos(1,1)
- local frame = frames[x]
- runFrame(frame)
- sleep(pause)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement