Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Message
| It's hard coded and I'm reluctant to change it at this stage. You can do it in Lua, for example from elsewhere on this forum:
local valid_direction = {
n = "n",
s = "s",
e = "e",
w = "w",
u = "u",
d = "d",
ne = "ne",
sw = "sw",
nw = "nw",
se = "se",
north = "n",
south = "s",
east = "e",
west = "w",
up = "u",
down = "d",
northeast = "ne",
northwest = "nw",
southeast = "se",
southwest = "sw",
['in'] = "in",
out = "out",
} -- end of valid_direction
-- for calculating the way back
local inverse_direction = {
n = "s",
s = "n",
e = "w",
w = "e",
u = "d",
d = "u",
ne = "sw",
sw = "ne",
nw = "se",
se = "nw",
['in'] = "out",
out = "in",
} -- end of inverse_direction
First you can "normalise" a direction by using the first table (so "up" becomes "u") and then use the second table to get the inverse direction.
"In" is done differently because it is a Lua keyword. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|