#atan2

1 messages · Page 1 of 1 (latest)

brisk kelp
#

atan2 is a useful function for calculating angles that doesn't seem to be in the game, so it should be added. The screenshot is an example of what it could do.

knotty agate
#

try “math.atan2”?

#

I’ve found the trig functions can be accessed with math. as a prefix but I’ve no clue if atan2 is there

brisk kelp
knotty agate
#

huh!

knotty agate
#

you’ll have to give the input as a complex number but it should be functionally identical

#

oh hold on

#

yeah no i don’t think this is something built into lua

quasi mist
#

In the version of Lua I’m using in the game, it’s just atan(y,x)

brisk kelp
#

It would still be nice to have the atan2 function as an alternative or to mention the 2-argument atan in the documentation to avoid confusion.

mild cairn
#

many things should be mentioned in the docs tbh

#

the docs seem more of a starting point atm than a full guide

quasi mist
#

I'll add more to the docs, beyond covering more functions (like this one), are there other big things that come to mind?

knotty agate
#

the notation where you can write stuff like ‘return x == y and 3’ to make everything that satisfies x == y return 3 is pretty integral to minimising code size

#

obviously there’s likely a better way to put it, but

#

I think having something about it in the docs would be good because you kinda need it to get the higher scores