Page 1 of 1

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

Posted: Thu Aug 13, 2026 11:52 am
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.

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

Posted: Thu Aug 13, 2026 1:20 pm
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.

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

Posted: Thu Aug 13, 2026 1:21 pm
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.

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

Posted: Thu Aug 13, 2026 2:40 pm
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.

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

Posted: Thu Aug 13, 2026 2:52 pm
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.

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

Posted: Thu Aug 13, 2026 3:08 pm
by worph
Both work now. :oops: :oops: sorry.