Code: Select all
/c game.player.map_view_settings.show_logistic_network = false
Code: Select all
LuaPlayer doesn't contain key map_view_settings
Code: Select all
/c game.player.map_view_settings.show_logistic_network = false
Code: Select all
LuaPlayer doesn't contain key map_view_settings
Thanks for the reply! But how do I do this exactly? I actually want this for a mod I am working on.orzelek wrote: Mon Aug 17, 2020 1:19 am Try to make a table with show_logistic_network = false and assing it to /c game.player.map_view_settings.
It makes a difference because map_view_settings is "write-only". By doing game.player.map_view_settings.foo, you are trying to get the game.player.map_view_settings table and index it with foo. But you cannot get game.player.map_view_settings since it is write-only (=not-readable), so you get the error.ickputzdirwech wrote: Mon Aug 17, 2020 7:14 amThanks for the reply! But how do I do this exactly? I actually want this for a mod I am working on.orzelek wrote: Mon Aug 17, 2020 1:19 am Try to make a table with show_logistic_network = false and assing it to /c game.player.map_view_settings.
And why would that make a difference? I thought the problem is that "player" doesn't recognise "map_view_settings" and not that "map_view_settings" doesn't recognise "show_logistic_network".
I don't know much about lua or about scripting/programming in general. I figured everything out my self, so sorry for the silly questions.
Code: Select all
local bar = nil
bar.baz = "hello" -- tries to index bar as if it was a table but bar is nil, so this errors.
bar = {baz = "hello"} -- assigns a table to bar, doesn't care that bar is nil.
Code: Select all
/c game.player.map_view_settings = {show_logistic_network = false}
Bilka wrote: Mon Aug 17, 2020 4:15 pm You need "show-logistic-network" with dashes instead of underscores, see the docs.
Code: Select all
/c game.player.map_view_settings = {show-logistic-network = false}
Code: Select all
'}' expected near '='
Lua....ickputzdirwech wrote: Mon Aug 17, 2020 6:51 pmBilka wrote: Mon Aug 17, 2020 4:15 pm You need "show-logistic-network" with dashes instead of underscores, see the docs.I tried that before (and at least 10 other variations) but it returns:Code: Select all
/c game.player.map_view_settings = {show-logistic-network = false}
Code: Select all
'}' expected near '='
Code: Select all
/c game.player.map_view_settings = {["show-logistic-network"] = false}