[SOLVED] - [string "ImageData.lua"]:38: bad argument #1 to 'max' (number expected, got nil)
Posted: Fri Mar 31, 2023 1:30 pm
Hi
I think there is a problem with the Image:mapPixel method or I am missing something too big, I kept getting this error for no apparent reason when I wanted to generate a texture:
I then reduced the problem as much as possible, removing all the function calls, calculations, etc., and so I ended up with this very small piece of stupid code which is apparently the cause of the error:
I tried with love 11.3 and 11.4 in doubt but still the same.
An idea ?
Edit: I wasted so much time on this that I was going crazy
It's just that when Y is 300 nothing is returned, but the error was confusing, sorry
A possible solution:
I think there is a problem with the Image:mapPixel method or I am missing something too big, I kept getting this error for no apparent reason when I wanted to generate a texture:
Code: Select all
[string "ImageData. lua"]:38: bad argument #1 to 'max' (number expected, got nil)
Code: Select all
renderBuffer:mapPixel(function (x, y)
if y < 300 then
return 0, .1, .5
elseif y > 300 then
return 0, .5, .1
end
end)
An idea ?
Edit: I wasted so much time on this that I was going crazy
It's just that when Y is 300 nothing is returned, but the error was confusing, sorry
A possible solution:
Code: Select all
renderBuffer:mapPixel(function (x, y)
if y < 300 then
return 0, .1, .5
elseif y > 300 then
return 0, .5, .1
end
return 0, 0, 0, 0
end)