[Pas2js] Multi dimensional static array to dynamic array?

Mattias Gaertner nc-gaertnma at netcologne.de
Tue May 15 17:11:52 CEST 2018


On Tue, 15 May 2018 21:59:23 +0700
Ryan Joseph <ryan at thealchemistguild.com> wrote:

>[...]
> It sounds like what you’re saying is that multidimensional arrays don’t map the same in JS so I shouldn’t be using them.

It depends on your needs.


> I could have keep the values in a flat array (like above) and indexed
> them using i = x + y * width but I wanted to avoid that since it’s
> extra overhead on a low level struct.

If pas2js would translate multi-dims to 1-dims it would have to do that
too.


> The temporary solution of copying out to list is much worse so I need to pick my poison perhaps. Varient records/unions are out of the question also as a possible solution.

Yes. Basically normal OpenGL programming heavily relies on address
space memory. JS does not have that.

Mattias


More information about the Pas2js mailing list