Posted 13 June 2012 - 04:20 PM
I am programming on a server and a browser (with a whole team) , and now im working on the browser… In this function:
its coarse searching for errors, but in one error detecting ( line 11 ) it says: attempt to compare boolean with number
so i put in a print command, and it prints 0 and 2, but the program says 0 (counter2) is a boolean! I don't know why, but I think its a bug, and I don't know how to repair it…
I'm from Germany, and my english skills are bad, so sometimes I had to use the Google translator :(/>/>
function hasAllStructures(theTable)
counter2=0
foundVariablesDeclaration=false
foundVariablesDeclarationEnd=false
foundOutprint=false
foundOutprintEnd=false
tablemaxn=table.maxn(theTable)
while true do
counter2=counter2+1
print(counter2.." "..tablemaxn)
if not counter2>tablemaxn then
--coarse search for errors
if theTable[counter2]=="VARIABLES-DECLARATION" then
foundVariablesDeclaration=true
elseif theTable[counter2]=="VARIABLES-DECLARATION-END" then
foundVariablesDeclarationEnd=true
elseif theTable[counter2]=="PRINT-OUT" then
foundOutprint=true
elseif theTable[counter2]=="PRINT-OUT-END" then
foundOutprintEnd=true
end
if counter2==table.maxn(theTable) then
break
end
else
if counter2==1 then
return false, "01"
else
return false, "02"
end
end
end
--return
if foundVariablesDeclaration~=true then
return false, "03"
elseif foundVariablesDeclarationEnd~=true then
return false, "04"
elseif foundOutprint~=true then
return false, "05"
elseif foundOutprintEnd~=true then
return false, "06"
else
return true
end
end
its coarse searching for errors, but in one error detecting ( line 11 ) it says: attempt to compare boolean with number
so i put in a print command, and it prints 0 and 2, but the program says 0 (counter2) is a boolean! I don't know why, but I think its a bug, and I don't know how to repair it…
I'm from Germany, and my english skills are bad, so sometimes I had to use the Google translator :(/>/>