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).
This doesn't happen when using technologies that don't contain any number (eg automation, optics etc).
[0.12.11] [kovarex] game.get_localised_technology_name gives error
-
- Filter Inserter
- Posts: 358
- Joined: Fri Jul 25, 2014 2:53 pm
- Contact:
Re: [0.12.11] game.get_localised_technology_name gives error
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
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.12.11] game.get_localised_technology_name gives error
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.
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.
Re: [0.12.11] game.get_localised_technology_name gives error
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).
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).
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.12.11] game.get_localised_technology_name gives error
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.
Re: [0.12.11] [kovarex] game.get_localised_technology_name gives error
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.
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.
Re: [0.12.11] [kovarex] game.get_localised_technology_name gives error
Thumbs up to you!