[2.1.14] LUA-API: LuaForce:get_space_platforms() and LuaPlanet:get_space_platforms(LuaForce) both failing

Place to get help with not working mods / modding interface.
worph
Fast Inserter
Fast Inserter
Posts: 176
Joined: Thu Jun 25, 2026 2:01 pm
Contact:

[2.1.14] LUA-API: LuaForce:get_space_platforms() and LuaPlanet:get_space_platforms(LuaForce) both failing

Post by worph »

What did you do?
I'm trying to write a mod that get's the space platforms over a planet.
I've tried using both:
  • a) LuaPlanet:get_space_platforms(LuaForce)
  • b) LuaForce:get_space_platforms()
I did my best to verify that both my LuaPlanet and LuaForce are actually the correct type of item and they very much seem to be.
For (a) I also tried all three parameter types (LuaForce, index, string).
What happened?
  • a) Error: "Invalid ForceID: expected LuaForce, force index or string." (no matter the input)
  • b) Error: "Given object (LuaForce) is not a LuaSpaceLocationPrototype."
What did you expect to happen instead? It might be obvious to you, but do it anyway!
That it would accept the inputs / process the function correctly.
Does it happen always, once, or sometimes?
Every time.

Sorry for breaking rule1

edit: Added a micro mod.
Attachments
worph-space-platform-test_0.0.1.zip
(478 Bytes) Downloaded 13 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4812
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.1.14] LUA-API: LuaForce:get_space_platforms() and LuaPlanet:get_space_platforms(LuaForce) both failing

Post by boskid »

Since you did not provide any examples of code failing and attached mod is a zip with empty directories, throwing this to Pending.
Rseding91
Factorio Staff
Factorio Staff
Posts: 17413
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.14] LUA-API: LuaForce:get_space_platforms() and LuaPlanet:get_space_platforms(LuaForce) both failing

Post by Rseding91 »

It sounds like you’ve mixed them up and are calling the A version on the B object and the B version on the A object.
If you want to get ahold of me I'm almost always on Discord.
worph
Fast Inserter
Fast Inserter
Posts: 176
Joined: Thu Jun 25, 2026 2:01 pm
Contact:

Re: [2.1.14] LUA-API: LuaForce:get_space_platforms() and LuaPlanet:get_space_platforms(LuaForce) both failing

Post by worph »

Im so sorry. Here is my test version, I packed the wrong folder.


Edit:
Looking more into it, I must have been super confused apparently.

In the 2.1.13 patch notes it says it introduced:

Code: Select all

LuaForce::get_space_platforms()
I must not have checked the documentation for this, as in the api docs it clearly states that it wants surface as a param (in contrast to the patchnnotes). I took the patchnotes as gospel, which one clearly should not do. :oops:
I will report back once I tested LuaForce::get_space_platforms() with the correct params.

However, the other method still never worked for me.
Attachments
worph-space-platform-test_0.0.1.zip
(1.1 KiB) Downloaded 13 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 17413
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.14] LUA-API: LuaForce:get_space_platforms() and LuaPlanet:get_space_platforms(LuaForce) both failing

Post by Rseding91 »

I see. You're calling the methods wrong.

Code: Select all

entity.surface.planet:get_space_platforms(entity.force)
Should be

Code: Select all

entity.surface.planet.get_space_platforms(entity.force)
And

Code: Select all

entity.force:get_space_platforms()
Should be

Code: Select all

entity.force.get_space_platforms()
Calling "planet:get_space_patforms(entity.force)" is syntax sugar for: "planet.get_space_platforms(planet, entity.force)" which explains why it's complaining the first argument you've passed is a planet and not a force.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Modding help”