Types/Order: Difference between revisions
Jump to navigation
Jump to search
(Created page with "The order property is a simple string. When the game compares 2 like prototypes if the order strings aren't equal they're lexicographical compared (https://en.wikipedia.org/wi...") |
(better formatting, added example) |
||
Line 1: | Line 1: | ||
The order property is a simple string. When the game compares 2 like prototypes if the order strings aren't equal they're | {{Languages}} | ||
The order property is a simple [[Types/string|string]]. When the game compares 2 like prototypes if the order strings aren't equal they're [https://en.wikipedia.org/wiki/Lexicographical_order lexicographical order] to determine if a given prototype comes before or after another. When the order strings are equal the game then falls back to comparing the prototype names to determine order. | |||
Example: The second item is shown before the first one (in the crafting grid/inventory etc) | |||
{ | |||
type = "item", | |||
name = "item-1", | |||
order = "a-d", | |||
}, | |||
{ | |||
type = "item", | |||
name = "item-2", | |||
order = "a-b", | |||
}, |
Revision as of 09:31, 6 July 2017
The order property is a simple string. When the game compares 2 like prototypes if the order strings aren't equal they're lexicographical order to determine if a given prototype comes before or after another. When the order strings are equal the game then falls back to comparing the prototype names to determine order.
Example: The second item is shown before the first one (in the crafting grid/inventory etc)
{ type = "item", name = "item-1", order = "a-d", },
{ type = "item", name = "item-2", order = "a-b", },