Page 1 of 1

[Rseding91] [2.0.33] reading the effect_description (a LocalisedString) returns unexpected data

Posted: Thu Feb 06, 2025 3:02 pm
by Quezler
In my latest mod i have added support to pass in some nothing modifiers in the data stage and parse what they mean in the control stage, but this seems to cause problems when using the {"", glue function, here is an example:

Code: Select all

table.insert(data.raw["technology"]["automation-science-pack"].effects, {
  type = "nothing",
  icon = "__core__/graphics/icons/any-quality.png",
  effect_description = {"foobar", {"", "foo", "bar"}}
})

Code: Select all

script.on_event(defines.events.on_player_created, function(event)
  local player = game.get_player(event.player_index) --[[@as LuaPlayer]]
  player.gui.screen.add{
    type = "label",
    name = "label",
    caption = {"foobar", {"", "foo", "bar"}},
  }
  log(serpent.block(player.gui.screen["label"].caption))
  log(serpent.block(prototypes.technology["automation-science-pack"].effects[2].effect_description))
end)

Code: Select all

  31.532 Script @__localised-string__/control.lua:8: {
  "foobar",
  {
    "",
    "foo",
    "bar"
  }
}
  31.532 Script @__localised-string__/control.lua:9: {
  "foobar",
  ""
}
Both effect_description on the nothing modifier and caption on the luagui are documented as LocalisedString, yet when given the same input data only the luagui returns the expected result (that being the full table used as the second argument), reading the effect description should return a nested {"", "foo", "bar"} instead of ""

Re: [Rseding91] [2.0.33] reading the effect_description (a LocalisedString) returns unexpected data

Posted: Thu Feb 06, 2025 7:05 pm
by Rseding91
Thanks for the report. This is now fixed for the next release.