[0.14.21] GameViewSettings parameters are strings

This subforum contains all the issues which we already resolved.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

[0.14.21] GameViewSettings parameters are strings

Post 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 1273 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?
quick links: log file | graphical issues | wiki
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5412
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.14.21] GameViewSettings parameters are strings

Post by Klonan »

It correctly shows as a boolean in 0.15, so i suppose it is already fixed:
Image
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: [0.14.21] GameViewSettings parameters are strings

Post 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.
quick links: log file | graphical issues | wiki
Rseding91
Factorio Staff
Factorio Staff
Posts: 16000
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.14.21] GameViewSettings parameters are strings

Post 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".
If you want to get ahold of me I'm almost always on Discord.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: [0.14.21] GameViewSettings parameters are strings

Post by daniel34 »

Thanks! Using show_alertgui for reading also works as expected as workaround in 0.14 :D
quick links: log file | graphical issues | wiki
Post Reply

Return to “Resolved Problems and Bugs”