Posted 25 March 2012 - 06:54 PM
I'm making my own api and am trying to create a function that displays all the stuff in a turtles inventory in a gui fashion:
When I ask it to start printing the actual numbers [print("| " .. slot1 .. " | " .. slot2 .. " | " .. slot3 " |")] the code returns an attempt to call string error, I am not sure why this is happening as the print function works with strings, does it not? Any help on this matter will be much appreciated.
function invPrint()
slot1 = tostring(turtle.getItemCount(1))
slot2 = tostring(turtle.getItemCount(2))
slot3 = tostring(turtle.getItemCount(3))
slot4 = tostring(turtle.getItemCount(4))
slot5 = tostring(turtle.getItemCount(5))
slot6 = tostring(turtle.getItemCount(6))
slot7 = tostring(turtle.getItemCount(7))
slot8 = tostring(turtle.getItemCount(8))
slot9 = tostring(turtle.getItemCount(9))
print("=============")
print("| | | |")
print("| " .. slot1 .. " | " .. slot2 .. " | " .. slot3 " |") //error
print("| " .. slot4 .. " | " .. slot5 .. " | " .. slot6 " |")
print("| " .. slot7 .. " | " .. slot8 .. " | " .. slot9 " |")
print("| | | |")
print("=============")
end
When I ask it to start printing the actual numbers [print("| " .. slot1 .. " | " .. slot2 .. " | " .. slot3 " |")] the code returns an attempt to call string error, I am not sure why this is happening as the print function works with strings, does it not? Any help on this matter will be much appreciated.