mg_villages.village_types can be nil

master
Ner'zhul 2015-03-16 20:32:04 +01:00
parent 2bac98db83
commit 8e1657c5df
1 changed files with 6 additions and 4 deletions

View File

@ -154,10 +154,12 @@ mg_villages.map_of_world = function( pname )
local i = 0.05;
formspec = formspec.."label[10,-0.4;Village types:]";
-- explain the meaning of the textures
for _,typ in ipairs(mg_villages.village_types) do
formspec = formspec.."label[10.5,"..tostring(i)..";"..tostring( typ ).."]"..
"image[10.0,"..tostring(i+0.1)..";0.4,0.4;"..tostring( mg_villages.village_type_data[ typ ].texture ).."]";
i = i+0.45;
if mg_villages.village_types ~= nil then
for _,typ in ipairs(mg_villages.village_types) do
formspec = formspec.."label[10.5,"..tostring(i)..";"..tostring( typ ).."]"..
"image[10.0,"..tostring(i+0.1)..";0.4,0.4;"..tostring( mg_villages.village_type_data[ typ ].texture ).."]";
i = i+0.45;
end
end
i = i+0.45;