C#字典和列表转LuaTable

function DicToLuaTable(Dic)
    --将C#的Dic转成Lua的Table
    local dic = {
    
    }
    if Dic then
        local iter = Dic:GetEnumerator()
        while iter:MoveNext() do
            local k = iter.Current.Key
            local v = iter.Current.Value
            dic[k] = v
        end
    end
    return dic
end


function ListToTable(List)
    --将C#的List转成Lua的Table
    local list = {
    
    }
    if List then
        local index = 1
        local iter = List:GetEnumerator()
        while iter:MoveNext() do
            local v = iter.Current
            list[index] = v
            index = index + 1
        end
    else
        logError("Error,CSharpList is null")
    end
    return list
end

猜你喜欢

转载自blog.csdn.net/qq_42194657/article/details/106407413
今日推荐