-- 管理员权限 local MngPermission = {} -- 按钮对应的权限为,{btn_1 删除玩家 1}{btn_2 添加玩家 2}{btn_3 增减体力值 4}{btn_4 禁止游戏 8}{btn_5 禁止同桌 16} function MngPermission.getPermData(perm) local perm_array = {} for i = 5, 1, -1 do local tem = math.pow(2, i - 1) local flag = perm >= tem table.insert(perm_array, 1, flag) perm = flag and perm - tem or perm end return perm_array end function MngPermission.getPermValue(array) local val = 0 for i = 1, 5 do if array[i] then val = val + math.pow(2, i - 1) end end return val end return MngPermission