When writing to a list with
Byond_WriteList
, logically false values (null, 0, and the empty string) are not added to the list. Similarly, when writing an assoc value with Byond_WriteListIndex
, the assoc value will be set to null if the passed in value is 0 or the empty string, even though those are not strictly null.Numbered Steps to Reproduce Problem:
1. Have a list in byondapi, be it passed in or created.
2a. Create an array of logically false CByondValues, then pass it into
Byond_WriteList
.AND/OR
2b1. Create or otherwise ensure the list contains a valid assoc key.
2b2. Write 0 or the empty string to the valid assoc key with
Byond_WriteListIndex
FINALLY
3. If the list was created externally, return it to BYOND.
Code Snippet (if applicable) to Reproduce Problem:
CByondValue list;
ByondValue_CreateList(&list);
CByondValue newListEntries[4];
ByondValue_Clear(&newListEntries[0]);
ByondValue_SetNum(&newListEntries[1], 0.0);
ByondValue_SetStr(&newListEntries[2], "");
ByondValue_SetStr(&newListEntries[3], "foo");
CByondValue foo;
ByondValue_SetStr(&foo, "foo");
CByondValue zero;
ByondValue_SetNum(&zero, 0.0f);
Byond_WriteList(&list, newListEntries, 4);
Byond_WriteListIndex(&list, &foo, &zero);
return list;
Expected Results:
The returned list should be equivalent to
list(null, 0, "", "foo" = 0)
Actual Results:
The returned list is equivalent to
list("foo")
Does the problem occur:
Every time? Or how often?
Always
In other games?
Not game-specific
In other user accounts?
Not account-specific
On other computers?
Untested
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
Older versions that still have byondapi make no mention of changing the behavior of
Byond_WriteList
or Byond_WriteListIndex
. As such, I have no reason to believe this is a regression.Workarounds:
The inability to append logically false values to a list with
Byond_WriteList
can be worked around by calling the `Add` proc on lists from byondapi. The inability to assign 0 or the empty string to assoc values cannot be worked around.