m
Move page script moved page XML/KeyValue to WoW:XML/KeyValue without leaving a redirect
(Created page with "{{uixmltype}} The WoW XML KeyValue elements add an arbitrary variable to a runtime Lua object. This mechanism is very akin to the Attribute...") |
m (Move page script moved page XML/KeyValue to WoW:XML/KeyValue without leaving a redirect) |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{uixmltypeprop}} | {{uixmltypeprop|KeyValue}} | ||
A [[XML/KeyValue|KeyValue]] element adds an arbitrary variable to the Lua runtime UI object. This mechanism is similar to the [[XML/Attribute|Attribute]] element, and to the [[XML/parentKey|parentKey]], [[XML/relativeKey|relativeKey]], and [[XML/targetKey|targetKey]] XML attributes, as these all add arbitrary member variables to Lua objects from [[FrameXML]]. See also [[XML/Attribute|Attribute]]. | A [[XML/KeyValue|KeyValue]] element adds an arbitrary variable to the Lua runtime UI object. This mechanism is similar to the [[XML/Attribute|Attribute]] element, and to the [[XML/parentKey|parentKey]], [[XML/relativeKey|relativeKey]], and [[XML/targetKey|targetKey]] XML attributes, as these all add arbitrary member variables to Lua objects from [[FrameXML]]. See also [[XML/Attribute|Attribute]]. | ||
| 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 | * '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. | ||