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)