Defining a list with mixed associative and non-associative elements can cause "runtime error: list index out of bounds"
Numbered Steps to Reproduce Problem:
- Define a list as shown below
- Run
Code Snippet (if applicable) to Reproduce Problem:
// Broken:
var/list/L = list("foo", "foo"=2, "foo")
var/list/L = list("foo", "foo"=2, "bar")
var/list/L = list("foo"=1, "foo"=2, "bar")
// Not broken:
var/list/L = list("foo", "foo"=2, "bar"=3)
var/list/L = list("foo"=1, "foo", "bar")
Expected Results:
Either a compile error, or a valid list
Actual Results:
Runtime error on the line the list is defined
Does the problem occur:
Every time? Or how often? Every time
In other games? N/A
In other user accounts? Yes
On other computers? Yes
When does the problem NOT occur?
- When keys are not repeated
- When all keys following the repeated associative key are associative
- When the repeated key is not associative in the repeats (it may be associative in the first instance without breaking)
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown
Workarounds: Don't repeat keys in list literals?
Also, why would anyone ever do this?