When I do this...
Code: Select all
player.image = love.graphics.newImage("sprites/Dodger.png")
error(player.image:type())
which is just what I'd expect.Image
But... when I use a protected call...
Code: Select all
player.image = love.graphics.newImage("sprites/Dodger.png")
local try = {pcall(player.image:type())}
error(try[1])
which appears to contradict the previous bit of code.false
By my understanding, pcall() only returns 'false' when the function it calls has an error. But, as I showed you, the function produced problem when called earlier. Without going into detail, I use the pcall() function extensively throughout my program as a sort error catching thingy (I don't remember the precise name for it, but that's close enough) to make sure a specific value is either an image or a quad. I need to know why it is returning 'false' instead of the expected 'true'.
Also, note that I use error() to return results because it ignores all preceding code (which is full of errors because of this pcall() issue). It's far more easy to use error() than create a whole new Love2d project JUST so I can use print() in the console. Either way, it gets the point across.