Page 1 of 1

[0.14.21] GameViewSettings parameters are strings

Posted: Fri Jan 06, 2017 7:32 pm
by daniel34
According to the documentation (http://lua-api.factorio.com/latest/Conc ... ewSettings) the GameViewSettings properties are boolean, but when querying the type using the command below it turns out they are actually strings:

Code: Select all

/c game.player.print(type(game.player.game_view_settings.show_research_info))
factorio-viewsettings-string.png
factorio-viewsettings-string.png (27.34 KiB) Viewed 1278 times
In boolean comparisons these properties will always evaluate to true, unless explicitly compared to "true" or "false" as string. The type should be consistent to spare the next modder some time-consuming bug search.

Second bug:
The property show_alert_gui is only writable, not readable (Error: LuaStruct::luaIndex: unknown path show_alert_gui ...). The documentation lists it as [Read-Write]. Writing to it works as expected.

Minor point of confusion (legacy code?):
The show_minimap property does the same as LuaPlayer.minimap_enabled, except that minimap_enabled actually returns a boolean. Is there a reason behind having two properties that do the same?

Re: [0.14.21] GameViewSettings parameters are strings

Posted: Fri Jan 06, 2017 7:44 pm
by Klonan
It correctly shows as a boolean in 0.15, so i suppose it is already fixed:
Image

Re: [0.14.21] GameViewSettings parameters are strings

Posted: Fri Jan 06, 2017 11:32 pm
by daniel34
What about the second bug? I'm able to work around the first bug, but I have no means of finding out if show_alert_gui is enabled or not and you didn't mention if that will be fixed.
daniel34 wrote:The property show_alert_gui is only writable, not readable (Error: LuaStruct::luaIndex: unknown path show_alert_gui ...). The documentation lists it as [Read-Write]. Writing to it works as expected.

Re: [0.14.21] GameViewSettings parameters are strings

Posted: Sat Jan 07, 2017 12:15 am
by Rseding91
daniel34 wrote:What about the second bug? I'm able to work around the first bug, but I have no means of finding out if show_alert_gui is enabled or not and you didn't mention if that will be fixed.
daniel34 wrote:The property show_alert_gui is only writable, not readable (Error: LuaStruct::luaIndex: unknown path show_alert_gui ...). The documentation lists it as [Read-Write]. Writing to it works as expected.
Fixed for 0.15. It was "show_alertgui" when reading. I changed it to "show_alert_gui".

Re: [0.14.21] GameViewSettings parameters are strings

Posted: Sat Jan 07, 2017 12:36 am
by daniel34
Thanks! Using show_alertgui for reading also works as expected as workaround in 0.14 :D