我如何 return 函数中的多个值 return in lua

How do I return multiple values in a function return in lua

我正在尝试将 return GetUserGroup 转换为多个值,但它只 returns 转换为 1 我尝试使用 for 语句但没有成功,我不想这样做 ply:GetUserGroup() == "owner"ply:GetUserGroup() == "superadmin" 这是解决问题的唯一方法,但它会排很长的队,我不能那样做

这是darkrp附加代码:

DarkRP.createEntity("Money printer", {
    ent = "money_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 1000,
    cmd = "buymoneyprinter",
    getMax = function(ply) 
    local limitRanks = {"odyssian", "tmod", "dmod", "dadmin", "admin", "superadmin", "co-owner", "owner"}
    return ply:GetUserGroup() == limitRanks and 6 or 3 
    end,
})

您需要将 limitRanks 转换为散列 table 并检查密钥是否存在于 return 语句中:

local limitRanks = {odyssian = true, tmod = true, dmod = true, dadmin = true,
  admin = true, superadmin = true, ["co-owner"] = true, owner = true}
return limitRanks[ply:GetUserGroup()] and 6 or 3