actboy168/YDWE

物编名字改为纯数字导致地图无法保存的问题

supemeko opened this issue · 0 comments

日志
2019-07-08 23:59:10.675 [event]-[error] exception: "...king\tool\WE\1.32.13\compiler\script\w3x2lni/slk_lib.lua:588: attempt to index a number value (local 'name')"

相关代码

local function get_displayname(o1, o2)
    if not o2 then
        o2 = {}
    end
    local name
    if o1._type == 'buff' then
        name = o1.bufftip or o1.editorname or o2.bufftip or o2.editorname
    elseif o1._type == 'upgrade' then
        name = o1.name[1] or o2.name[1]
    elseif o1._type == 'doodad' or o1._type == 'destructable' then
        name = w2l:get_editstring(o1.name or o2.name)
    else
        name = o1.name or o2.name
    end
    if not name then
        name = '<未知>'
    end
    return name:sub(1, 100):gsub('\r\n', ' ')
end