local memory = {}
local nmem = {}
--[[
where:
objs is a table containing a list of the objects, (objects consist of {x,y,[color]})
i is the current iteration of the memory it is drawing,
n is the maximum iteration of memory,
cols is a table containing the colour objects will be drawn in at different iterations of the memory
]]
local function draw(objs, i, n, cols)
if i == 0 then
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)
term.clear()
end
for j=1,#objs do
local obj = objs[j]
local color = cols[i+1]
if type(color) ~= "number" then color = colors.white end
if obj[3] ~= nil then color = obj[3] end
term.setCursorPos(obj[1], obj[2])
term.setTextColor(colors.black)
term.setBackgroundColor(color)
term.write(" ")
end
term.setCursorPos(i+1,1)
print(i)
for i=1,#info do
--print(info[i])
end
info = {}
if i < n then
local oclone = {}
for j=1,#objs do oclone[j] = objs[j] end
nmem[i+1] = oclone
if memory[i+1] ~= nil then
draw(memory[i+1], i+1, n, cols)
else
memory = nmem
end
else
memory = nmem
end
end
I'm inputting
draw(tab, 0, 2, {colors.white, colors.lightGray, colors.gray})
where tab is a table of objects to draw, this has no errors in it…basically, it's just drawing the objects in the same positions regardless of what stage it is in the memory, so it results in having the standard objects without memory but in gray instead of white.
I'm completely stumped as to what I should do, so I'm asking the forums.
if anyone can help at all, it would seriously be appreciated.