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

Place to get help with not working mods / modding interface.
fredthedeadhead
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Mon Oct 18, 2021 6:13 pm
Contact:

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

Post 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.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3724
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post by DaveMcW »

You are correct, it is an error. You should report it here: viewtopic.php?f=28&t=97880
fredthedeadhead
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Mon Oct 18, 2021 6:13 pm
Contact:

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

Post 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.
Post Reply

Return to “Modding help”