Page 1 of 1
upgrade planner's get_mapper()'s to can return nil
Posted: Thu May 08, 2025 11:57 am
by Quezler
The from side when "empty" will still return a table, the to side when empty can return nil:
/c game.print(serpent.line(game.player.cursor_stack.get_mapper(1, "from"))) -- {type = "item"}
/c game.print(serpent.line(game.player.cursor_stack.get_mapper(1, "to"))) -- nil
Re: upgrade planner's get_mapper()'s to can return nil
Posted: Fri May 09, 2025 9:23 am
by Therenas
Isn't this more of a bug? Returning "{type = "item"}" doesn't make sense right? Should be nil?
Re: upgrade planner's get_mapper()'s to can return nil
Posted: Fri May 09, 2025 1:20 pm
by Quezler
well it makes sense in the way that the slot is reserved and there isn't a nil gap, like empty logistic filters in a section return {} and not nil too, which way belongs where is very much just in the eye of the devs
There's probably a technical reason here why the source needs to be set to something not-nil when there's just a destination defined, i'll leave it up to you guys to figure out whether the destination should be marked as optional, making both return a table, or making both optional

Re: upgrade planner's get_mapper()'s to can return nil
Posted: Thu May 29, 2025 8:58 am
by Therenas
Alrighty updated the docs for the next release to mention this, and added some missing fields to UpgradeMapperSource and UpgradeMapperDestination . Thanks for the report.
Re: upgrade planner's get_mapper()'s to can return nil
Posted: Thu May 29, 2025 3:27 pm
by sarfact
Makes sense now, if the "from" side needs to stay non-nil for internal consistency, like how empty logistics filters return {}. Good call raising it, and thank you