According to the documentation love.graphics.newImage should return an 'Image' type. However it appears to be returning type of 'userdata' and I can not call the image methods on it. here is a minimal example from my attempt to learn love by making a simple breakout game.
Code: Select all
Rect = require'rect'
function love.load()
love.window.setMode(400,500)
-- make block grid
Blocks = {}
local pinkBlock = love.graphics.newImage('assets/block.png') -- output is 'userdata'
print(type(pinkBlock));
for i=0, 20 do
local nextRow = {}
for c=0, 10 do
table.insert(nextRow, {Rect.createRect(pinkBlock)})
end
table.insert(Blocks, nextRow)
end
--set Window Size
love.window.setMode(CalculateGridWidth(Blocks[1]), CalculateGridHeight(Blocks)+200)
end