
Originally Posted by
Techni
You can do all of these via regular array functions through loops and such, adding them to the LUA wouldn't have any speed increase as you'd still have to search through the entire array/table for most of these.
No, Lua can currently do more with arrays and tables than E2 can.

Originally Posted by
Techni
R:removeShift(N)
That's how the current array remove works.
Okay.

Originally Posted by
Techni
R:remove(N)
Not really possible (That's not how arrays work)
It is in E2. Again,

Originally Posted by
Techni
T:remove(S)
Can be done by setting the string to a null value, ie 0, vec(), noentity() etc
If doing that removes it from the table, then E2 tables are messed up.

Originally Posted by
Techni
R:contains(N)
Requires a linear search through the array, can be done in 3 lines of E2 code and will be laggy with large arrays even in LUA. Use a lookup table
What about
Code:
return (Array[Index] ~= nil)

Originally Posted by
Techni
R:containsValue(*)
As above.
Yes, this one would require a linear search through the array. It would still be a lot easier and slightly faster than doing the same in E2, though, and could use ops proportional to the size of the table. Or it could be omitted altogether, since it's not particularly useful.

Originally Posted by
Techni
T:contains(S)
Use a look up table
Um, what? The table T is the lookup table. That's why you're trying to look up the key S in it. And again,
Code:
return (Table[Key] ~= nil)

Originally Posted by
Techni
T:containsValue(*)
use a look up table
Same response as A:containsValue(*) above
Disclaimer: I don't know much Lua so the Lua code provided is probably slightly wrong. However, it's also probably mostly right.
PS. It's Lua not LUA.
Bookmarks