Lua API: Fix an error in the terrain hex API

Attempting to access a non-string key was an error.
This commit is contained in:
Celtic Minstrel 2021-08-15 12:42:47 -04:00 committed by Celtic Minstrel
parent 19c61374ff
commit 45f47fc3e6

View file

@ -101,7 +101,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
return self.x
elseif key == 2 then
return self.y
elseif #key > 0 and key[0] ~= '_' then
elseif type(key) ~= string or (#key > 0 and key[0] ~= '_') then
return hex_mt[key]
end
end