Page 1 of 1

Documentation says Position x/y are ints, but they return floats

Posted: Sun Nov 28, 2021 9:09 am
by fredthedeadhead
https://lua-api.factorio.com/latest/Con ... l#Position

Position x and y are documented as being ints, but when I get the player's position, it returns floating point numbers with decimal places.

Code: Select all

/c local p = game.player p.print(p.position.x.." "..p.position.y)  
-0.05078125, 46.48828125

I suspect I am misunderstanding something because it seems quite basic. I hope someone can clear it up for me! Thanks in advance.

Re: Documentation says Position x/y are ints, but they return floats

Posted: Sun Nov 28, 2021 9:12 am
by DaveMcW
You are correct, it is an error. You should report it here: viewtopic.php?f=28&t=97880

Re: Documentation says Position x/y are ints, but they return floats

Posted: Sun Nov 28, 2021 9:52 am
by fredthedeadhead
Done, thanks! I'm looking quite closely at the types of fields so it's good to know where to go.

Having the correct types documented makes using https://github.com/GlassBricks/typed-factorio/ even more useful.