Localised names
Posted: Fri Oct 23, 2015 5:04 pm
Is there a way to get localised name of ie. recipe in control.lua?
This sux :/ Its not even helpful for print since i would need it to be dynamic not static :/Adil wrote:game.player.print method converts the lua name to localised. It is even capable of concatenating those.
They're probably inaccessible other way.
You didn't actually look at the wiki page, did you?oLaudix wrote: i would need it to be dynamic not static :/
Its impossible to do:Adil wrote:You didn't actually look at the wiki page, did you?oLaudix wrote: i would need it to be dynamic not static :/
Or is my definition of dynamic different from your?
Code: Select all
for i,ingredient in pairs(recipe.ingredients) do
local a = ingredient.name
game.player.print({"entity-name.a"})
end
Code: Select all
a='entity-name.gun-turret'
game.player.print({a})
game.player.print({"",{a}," is destroyed"})
Code: Select all
for i,ingredient in pairs(recipe.ingredients) do
local a = "item-name."..ingredient.name
game.player.print({a})
end
See? You clearly saw something I didn't. I wont apologise for not knowing everything. I will thank you for the code thought, it works exacly as i need.Adil wrote:Well, among those file lines of code are three, which are a part of working mod:(Even more, in real mod it's concatenation of two localized strings.)Code: Select all
a='entity-name.gun-turret' game.player.print({a}) game.player.print({"",{a}," is destroyed"})
Your code should be like this to work:Code: Select all
for i,ingredient in pairs(recipe.ingredients) do local a = "item-name."..ingredient.name game.player.print({a}) end
Code: Select all
game.item_prototypes[ingredient.name].localised_name