Unique Ids: Difference between revisions
From HLKitWiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
#Unique ids can be a maximum of ten (10) characters in length. | #Unique ids can be a maximum of ten (10) characters in length. | ||
#Unique ids may only contain the standard alphabetic characters (A-Z and a-z), numeric characters (0-9), and the underscore ( | #Unique ids may only contain the standard alphabetic characters (A-Z and a-z), numeric characters (0-9), and the underscore ('_'). | ||
#Unique ids are '''case sensitive''' ("foo" is not the same as "Foo" is not the same as "FOO"). | |||
#While it is technically legal for a unique id to start with a numeric character (0-9), it is generally NOT a good idea to do so. If a unique id begins with a numeric character, it will not be able to be used in most scripts, rules, and tag expressions (since starting with a numeric character causes Hero Lab to think the unique id is a numeric value). | #While it is technically legal for a unique id to start with a numeric character (0-9), it is generally NOT a good idea to do so. If a unique id begins with a numeric character, it will not be able to be used in most scripts, rules, and tag expressions (since starting with a numeric character causes Hero Lab to think the unique id is a numeric value). | ||
#All unique ids must be unique within a defined context. For example, it is not valid to have two different tag groups with the unique id | #All unique ids must be unique within a defined context. For example, it is not valid to have two different tag groups with the unique id "mygroup". However, it IS perfectly reasonable to have a tag group named "mine" and a rule set that is also named "mine", since they represent different contexts. | ||
{{note}}The notable exception to # | {{note}}The notable exception to #4 above is for tags, where purely numeric ids are common (to represent ranges, levels, resource costs, etc.). Since tags are always referenced with their tag group, a purely numeric tag id incurs none of the liabilities mentioned above. |
Latest revision as of 09:26, 17 December 2008
Context: HL Kit … Basic Concepts and Terminology
Most objects within HL are assigned a unique identifier so that they can be easily referenced throughout the data files. For example, each thing needs to have a unique value. HL uses unique ids for naming objects. Unique ids must comply with a number of rules, as outlined below. These rules enable HL to achieve significant performance optimizations at run-time, so these restrictions are important.
- Unique ids can be a maximum of ten (10) characters in length.
- Unique ids may only contain the standard alphabetic characters (A-Z and a-z), numeric characters (0-9), and the underscore ('_').
- Unique ids are case sensitive ("foo" is not the same as "Foo" is not the same as "FOO").
- While it is technically legal for a unique id to start with a numeric character (0-9), it is generally NOT a good idea to do so. If a unique id begins with a numeric character, it will not be able to be used in most scripts, rules, and tag expressions (since starting with a numeric character causes Hero Lab to think the unique id is a numeric value).
- All unique ids must be unique within a defined context. For example, it is not valid to have two different tag groups with the unique id "mygroup". However, it IS perfectly reasonable to have a tag group named "mine" and a rule set that is also named "mine", since they represent different contexts.
NOTE! The notable exception to #4 above is for tags, where purely numeric ids are common (to represent ranges, levels, resource costs, etc.). Since tags are always referenced with their tag group, a purely numeric tag id incurs none of the liabilities mentioned above.