In short:
list/.list./datum/smth = list() //.list. means any amount of /list/
smth[x].[.]. = somedatum //.[.]. means any amount of [.], where . is any index.
Will yield an error: "List bounds"
I tried to make new proc for lists, but unfortunately, i may not create new procs for /list.
So, in order to just add new value in existing dynamic multidimensional lists you have to check at least three things (for 2D lists) and that's not OK.
So, i request new Append proc for such lists which will automatically expand list at some dimension and create new list for list at this dimension on some index.
ID:1660281
![]() Aug 17 2014, 5:27 pm
|
|||||||
| |||||||
Well, i think that should be added in default framework. That (Append and Expand functions) is pretty common in most of programming languages and i don't see any reasons why it shouldn't be in DM language.
|
Essentially /list is not a proper datum; it does not have support to add new procs. That's something we've wanted to change for some time, but it's been very low-priority. The /savefile type is much the same. You can add procs to /world and /client, although the usefulness of the former is fairly dubious, but those aren't actually true datums either.
Of course, multidimensional lists aren't terribly useful in DM anyway. There's usually a much better way around them. None of this is to say the feature wouldn't be considered, but just to explain why things are as they are at this point. I do think if you're going to work with multidimensional lists, just having a stable of helper procs for them is a good idea for now. Bear in mind every list consumes some memory, and a multidimensional list is actually a list of lists, so you'd want to make sure you weren't using these in cases that didn't need it. |
For example, something like this handles resizing a two-dimensional list:
http://www.byond.com/forum/?post=1480536#comment8456281
You could write something similar to automatically resize the multidimensional list to include any new index you add.