[JS] Expend arrays over natives

Lua has vector expansion which is super convenient and lets you do things like SetEntityCoords(GetVehiclePedIsUsing(PlayerPedId()), GetEntityCoords(GetPlayerPed(127))) (Teleports your vehicle to player 127).

But sadly, JS does not have something like that, because JS returns it as arrays, and natives just use arrays as the first argument only and do not expend it.

Is it possible to add this feature to JS too?

Yeah, but it’s not likely to happen, as this ‘feature’ already makes the Lua native invocation code a bit of a convoluted mess, and in JS it’d be even weirder (see TS definitions).

Rather would see natives eventually directly mention vector arguments rather than this inconsistent ‘maybe’ expansion.

1 Like

I guess that is even weirder, as to how would it be implemented? A different native or change the parameters to the current existing natives (which will break lots of code)?

This, but in a new explicitly incompatible mode (per-resource, like the current manifest versions).