Thanks Hans!

I can see that bytemaps are going to be very useful. As for needing more than 1024...
Thanks again.
Best Wishes 

On Sun, 11 May 2025, 19:11 Hans Hagen, <j.hagen@xs4all.nl> wrote:
On 5/11/2025 6:07 PM, Keith McKay wrote:
> Hi all,
>
> I've been playing with bytemaps (see the latest LuaMetaFun manual) and I
> have come across a problem when I create more than 15 bytemaps. This
> came about as part of a bigger project where I create a large bytemap
> and then make smaller bytemaps with the data from the large bytemap.
> I've made a MWE below
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>   \startMPpage
> i := 1;
> for x = 1 upto 5:
>   for y := 1 upto 5:
>      newbytemap i of (250,250,3);
>      setbytemap i to (floor(uniformdeviate(255) +
> 1),floor(uniformdeviate(255) + 1),floor(uniformdeviate(255) + 1));
>      fill
>          unitsquare xyscaled (250,250) shifted ((x) * 255, (y) *255)
>          withbytemap i;
>      i := i + 1;
>      endfor;
> endfor;
> \stopMPpage
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> The MWE above is for a 5 X 5 grid of randomly generated colours and you
> can see that the last 10m squares are black. Changing x or y to 3 will
> give 15 coloured squares, but  a 4 X 4 grid and above gives black
> squares above 15 coloured squares. I can't see anything wrong with the
> code so I'm wondering if it is a bug.
> Any advice would be gratefully received. I'm running the latest update
> on a mac mini M1.

Ah, we have a buglet here. It started out as max 16 bytemaps but then I
bumped to (max) 1024 but forgot to replace some range tests. You can
test the new bin from the compile farm.

Thanks for keeping me on the edge. Do we need more than 1024? I guess not.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------