[0.12.2]game.player.print table

This subforum contains all the issues which we already resolved.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

[0.12.2]game.player.print table

Post by Adil »

One of the error messages on incorrect usage of game.player.print states: Invalid literal type (boolean) in localisedstring, table, string or number type expected.
Apart from the fact that it cannot print bool, it can also be inferred from this message that it can print tables, but invocation with table also results into error about unknown keys. (even if the table consists of localised strings)
Could there be some clarification on that?
(Was the previous thread silently moved to help or it was me missing a board?)
edit: nevermind, a table of localised strings worked I've just missed the category when referencing it, sorry.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.12.2]game.player.print table

Post by Oxyd »

I'm a little confused here – what's the bug, exactly?
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: [0.12.2]game.player.print table

Post by Adil »

Function usage hint:
Invalid literal type (boolean) in localisedstring, table, string or number type expected
mentions tables but function can't print them.
Don't bother though , it's my bad. I've figured out later, that a table there stands for a table of localised strings, for which function works correctly.

edit: Sorry, that's me again actually function only prints the first element of table:

Code: Select all

/c game.player.print({'entity-name.gun-turret', 'entity-name.laser-turret'})
Gun turret
edit: I feel silly now.
I've put results of my experiments on game.player.print() on wiki. Could we please get corrections on that?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.12.2]game.player.print table

Post by kovarex »

Actually, it has to be always in the {} brackets when it is localised string. The wiki was just plain wrong. I fixed the wiki.
Post Reply

Return to “Resolved Problems and Bugs”