Switch to edit mode.
Name(s): parse_ordinal_reference parse_ordref1: ":parse_ordref(string)"
2: "Parses strings referring to an 'nth' object."
3: "=> {NUM n, STR object} Where 'n' is the number the ordinal represents, and 'object' is the rest of the string."
4: "=> 0 If the given string is not an ordinal reference."
5: " Example:"
6: ":parse_ordref(\"second broadsword\") => {2, \"broadsword\"}"
7: ":parse_ordref(\"second\") => 0"
8: " Note that there must be more to the string than the ordinal alone."
9: if (m = match(args[1], "^" + this.ordinal_regexp + " +%([^ ].+%)$"))
10: o = substitute("%1", m)
11: n = o in this.ordn || o in this.ordw
12: return n && {n, substitute("%2", m)}
13: else
14: return 0
15: endif