WoW:XML/KeyValue: Difference between revisions

mNo edit summary
Line 30: Line 30:
* Required values - both 'key' and 'value' must be set to at least "" (empty string), unless the corresponding 'type' or 'keyType' is set to 'nil'. If 'key' is not set then the element ends up being ignored, regardless of the other attributes, and if 'value' is not set then the 'key' member in frame ends up being set to 'nil' regardless of any other attributes or inherited values.
* Required values - both 'key' and 'value' must be set to at least "" (empty string), unless the corresponding 'type' or 'keyType' is set to 'nil'. If 'key' is not set then the element ends up being ignored, regardless of the other attributes, and if 'value' is not set then the 'key' member in frame ends up being set to 'nil' regardless of any other attributes or inherited values.
* 'number' type - if 'type' or 'keyType' is 'number' and corresponding 'value' or 'key' is "" (empty string), then result is 0, but if 'value' or 'key' is 'nil' then result is 'nil'. Number can use used as key to allow regular table indexed values in UI Lua object.
* 'number' type - if 'type' or 'keyType' is 'number' and corresponding 'value' or 'key' is "" (empty string), then result is 0, but if 'value' or 'key' is 'nil' then result is 'nil'. Number can use used as key to allow regular table indexed values in UI Lua object.
* 'nil' type - if 'keyType' or 'type' set to 'nil' any corresponding 'key' or 'value' attribute to be ignored, but not cause an error. Additionally for the 'key' attribute, setting 'nil' would be as though 'frame[nil] = "value"' had been called for 'value' attribute, setting 'nil' would be as though 'frame["key"] = nil' had been called and is useful for overriding previous inherited value to 'nil'.
* 'nil' type - if 'keyType' or 'type' set to 'nil' any corresponding 'key' or 'value' attribute to be ignored, but not cause an error. Additionally, for the 'key' attribute, setting 'nil' would be as though 'frame[nil] = "value"' had been called for 'value' attribute. For 'type' setting 'nil' would be as though 'frame["key"] = nil' had been called and is useful for overriding previous inherited value to 'nil'.
* 'global' type - if 'keyType' or 'type' set to 'global', the corresponding 'key' or 'value' will be used as key to look up a up a value from the global _G[] scope, as available before frame load time, and the result of that used instead. For the 'key' attribute, setting 'global' would be as though 'frame[_G["key"]] = "value"' had been called, and for 'value' setting 'global' would be as though 'frame["key"] = _G["value"]' had been called, and can be useful for setting values based on global language specific strings.
* 'global' type - if 'keyType' or 'type' set to 'global', the corresponding 'key' or 'value' will be used as key to look up a up a value from the global _G[] scope, as available before frame load time, and the result of that used instead. For the 'key' attribute, setting 'global' would be as though 'frame[_G["key"]] = "value"' had been called, and for 'value' setting 'global' would be as though 'frame["key"] = _G["value"]' had been called, and can be useful for setting values based on global language specific strings.