When we introduced arrays, we intentionally didn't add a lot of functions that worked on them, since we wanted to gather some experience on how they were used first. Well, that experience should be available now, but I don't have it myself. What I remember being requested are functions to sort and append to an array. There's probably also a use for a deep comparison function (one that returns true when comparing two distinct arrays/proplists with the same contents). Are there other commonly used functions that should be documented and/or moved into the engine?
Do you only mean functions that work on arrays or also mean functions that work with arrays? For example we got (a lot?) of stuff like
which could also be written like this if a function were available (like FindObjects):
Just from the top of my head, there would at least be stuff for player, inventory, crew(?). But if the introduction makes sense, is another question. To add functions that work on arrays, like you suggest, probably make a lot more sense first.
------------
However, I think I never stumbled upon any function for arrays I missed so far in my implementation work.
------------
Why moved to the engine? What's wrong about System.c4g?
for(var i=0,j; i=GetPlayerByIndex(j);++i)
which could also be written like this if a function were available (like FindObjects):
for(var player in GetPlayers())
Just from the top of my head, there would at least be stuff for player, inventory, crew(?). But if the introduction makes sense, is another question. To add functions that work on arrays, like you suggest, probably make a lot more sense first.
------------
However, I think I never stumbled upon any function for arrays I missed so far in my implementation work.
------------
>Are there other commonly used functions that should be documented and/or moved into the engine?
Why moved to the engine? What's wrong about System.c4g?
I heard, to implement something in the engine rather than in the System.c4g leads to a better performance. Dunno why or who said this, maybe because this way you dont have to parse the System.c4g every time.
If performance was the #1 goal, everything would be in C++ and there would be no C4Script.
Some functions which could be implemented in script really need to be in the engine for performance reasons. (FindObjects could be replaced with script and a function which just returned a list of all objects, but it'd be unplayable.) GetPlayers is not one of them, but it probably makes more sense to make GetPlayers be the engine function and remove GetPlayersByIndex at some later point. The same for the other lists.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill