0
点赞
收藏
分享

微信扫一扫

持续集成交付CICD:基于ArgoCD 的GitOps 自动化完成前端项目应用发布与回滚

月半小夜曲_ 2023-12-24 阅读 49

C#字典和列表转LuaTable

将C#Dictionary转成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

将C#List转成luaTable

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

举报

相关推荐

0 条评论