Posted 23 January 2018 - 02:04 AM
ok so I am basically making the 2048 game and where I do my FillCheck function I get
attempt to compare table with number and I don't know what's wrong (Code edited as recommended)
attempt to compare table with number and I don't know what's wrong (Code edited as recommended)
function Game()
Page() -- clears and sets out page
Board = {
{{0},{0},{0},{0},{0}},
{{0},{0},{0},{0},{0}},
{{0},{0},{0},{0},{0}},
{{0},{0},{0},{0},{0}},
{{0},{0},{0},{0},{0}}
}
Filled ={
{{},{},{},{},{}},
{{},{},{},{},{}},
{{},{},{},{},{}},
{{},{},{},{},{}},
{{},{},{},{},{}}
}
function FillCheck()
for i = 1,5 do
for I = 1,5 do
if Board[i][I] > 0 then --this line causing error
Filled[i][I] = true
else
TempGenFun()
end
end
end
end
function TempGenFun()
TempX = math.random(1,5)
TempY = math.random(1,5)
TempGen = math.random(1,3)
if TempGen == 3 then
TempGen = 4
end
end
TempGenFun()
FillCheck()
Board[TempY][TempX] = TempGen
TempGenFun()
FillCheck()
Board[TempY][TempX] = TempGen
for i = 1,5 do
for I = 1,5 do
term.write(board[i][I])
end
end
end
Edited on 23 January 2018 - 01:38 AM