[0.12.11] [kovarex] game.get_localised_technology_name gives error

This subforum contains all the issues which we already resolved.
Post Reply
MrDoomah
Fast Inserter
Fast Inserter
Posts: 196
Joined: Mon Jun 01, 2015 1:11 pm
Contact:

[0.12.11] [kovarex] game.get_localised_technology_name gives error

Post by MrDoomah »

When trying to get a string using game.get_localised_technology_name, it gives an error if the technology name ends in a number (eg, automation-2).

Image

This doesn't happen when using technologies that don't contain any number (eg automation, optics etc).

cartmen180
Filter Inserter
Filter Inserter
Posts: 358
Joined: Fri Jul 25, 2014 2:53 pm
Contact:

Re: [0.12.11] game.get_localised_technology_name gives error

Post by cartmen180 »

that's because those techs don't have their own string. They take theirs from their previous tier and simply add a number after it. (At least that is how i think it works)
Check out my mods

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [0.12.11] game.get_localised_technology_name gives error

Post by bobingabout »

Yeah, I agree with cartmen, if a technology ends with a -#, EG automation-2 it will display the locale entry for automation with a number after it "Automation 2" for example.

It's basically to minimise the number of locale entries required for things that usually have multiple tiers, like research. it doesn't work with entities or items, just technology.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

MrDoomah
Fast Inserter
Fast Inserter
Posts: 196
Joined: Mon Jun 01, 2015 1:11 pm
Contact:

Re: [0.12.11] game.get_localised_technology_name gives error

Post by MrDoomah »

That makes sense internally, but for an api it should still return "automation 2".

Now I need to take the technology name, strip it of its number (if any) and the dash before it, run that through the get_localised_name, and then add the number back in. Besides, as far as I know, trying to manipulate the string coming from get_localised_name results in an error an sich, stating you can't concatenate a table and string (but that's from the top of my head, but I'm 99% sure).

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [0.12.11] game.get_localised_technology_name gives error

Post by bobingabout »

I'm not entirely sure this is actually a bug, but I agree that if the game itself is able to parse a technology localisation string, then the command should return the same result as well, instead of an error.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.12.11] [kovarex] game.get_localised_technology_name gives error

Post by kovarex »

The error was in the internal code that pushes compound localisation string into lua, quite internal thing.

It is fixed for 0.12.12.

P.S. I should also update the interface, as this should be read-only propertly of LuaTechnology instead.

MrDoomah
Fast Inserter
Fast Inserter
Posts: 196
Joined: Mon Jun 01, 2015 1:11 pm
Contact:

Re: [0.12.11] [kovarex] game.get_localised_technology_name gives error

Post by MrDoomah »

Thumbs up to you!

Post Reply

Return to “Resolved Problems and Bugs”