I use Love2D with lua and when i use 5 quads (love.graphics.newQuad) It seems to work just fine, but when i use 6 quads there shows a weird error:
Error menu.lua:9: Incoorect parameter type: expected userdata.
Traceback [C]: in function 'drawq'
menu.lua:9: in function 'draw'
[C]: in function 'xpcall'
Menu line 9 is this:
love.graphics.drawq(Tileset, Quads[number], x, y)
I assume it has something to do with the quads cause when i delete the sixth one from the tile map and the 6th quad it will load.
I tried to copy the other quads to see if i miss spelld something, but this is not the case.
Here is the code:
You are only defining 5 entries in the Quads
table in your main.lua
. If you look closely at mapsload.lua
at MenuBack
row 17, you will see the value 6 standing lonely among 1-5.
Now when want to use Quads[6]
, that key is not in the table Quads
. Therefore Lua returns nil. And as you can guess, nil is not userdata, that is why the function drawq
fails.