Dictionary Initialization & Use
Posted: Mon Sep 01, 2008 4:59 pm
I've noticed twice now that dictionaries (and likely structs) must be first put into a variable before being used. The following two incidences compiled, but failed for me:
The function did not return any value.
entry did not contain a "disabled" member at all; not a dict, not an error, nothing.
In each instance, putting the dictionary into a "var temp := dictionary {....};" before returning or assigning it has fixed the problem.
Code: Select all
return dictionary { "opponent" -> who };
Code: Select all
var entry := dictionary;
entry["disabled"] := dictionary { FIGHT_DISABLE_ATTACK -> 0, FIGHT_DISABLE_ITEMS -> 0 };
In each instance, putting the dictionary into a "var temp := dictionary {....};" before returning or assigning it has fixed the problem.