ai_helper.put_labels: display content of strings rather than 'nan'

This commit is contained in:
mattsc 2013-12-02 10:58:49 -08:00
parent 3115b139b7
commit 623036af16

View file

@ -82,8 +82,13 @@ function ai_helper.put_labels(map, cfg)
if cfg.keys then
for i,k in ipairs(cfg.keys) do data = data[k] end
end
out = tonumber(data) or 'nan'
if (type(data) == 'string') then
out = data
else
out = tonumber(data) or 'nan'
end
end
if (type(out) == 'number') then out = out * factor end
W.label { x = x, y = y, text = out }
end)