Module:Privages

local p = {} local default_privages = {"teleport","home","fly","fast","creative","shout","interact","tp","tp_tpc","watch"} local all_privs_str = "diglocks, openlocks, flight_licence, hp20_enable, vote_admin, mob_basics_spawn, tp, ccs_donater, train_admin, anti_lava_area_admin, basic_privs, setblock, apartment_spawn, areas, wiki_admin, atlatc, jail, creative, bring, teleport, tp_tpc, interlocking, home, rollback, track_builder, tp_admin, multihome, shout, terraform, password, notify, kick, worldedit, watch, pencil_redo_long_names, noclip, ccs_helper, privs, fast, pvp_areas_admin, streetlight, mob_pickup, weather, peaceful_player, apartment_unrent, ui_full, tunneling, travelnet_remove, travelnet_attach, serversay, fly, anti_lava_area_ignore, train_operator, news_bypass, scadmin, adminshop, economy, blockexchange, ban, signslib_edit, debug, give, blockexchange_protected_upload, dont_delete, engrave_long_names, robot, areas_high_limit, wiki, protection_bypass, railway_operator, scmoderator, server, interact, settime, puzzle"

local function split (inputstr, sep) -- https://stackoverflow.com/a/7615129/12805899 if sep == nil then sep = "%s" end local t = {} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do		table.insert(t, str) end return t end

function p.generatePrivagesString(privs_table) local rstr = "" local length = 0 for x,y in pairs(privs_table) do		length = length + 1 end local orig_length = length for x,y in pairs(privs_table) do		if length == orig_length then rstr = rstr .. y		elseif length == 1 then rstr = rstr .. " and " .. y		else rstr = rstr .. ", " .. y		end length = length - 1 end return rstr end

function p.main(frame) if type(privages) ~= "string" then privages = frame.args[1] or frame:getParent.args[1] or "" end if privages == "all" then privages = all_privs_str end privages = privages:gsub(" ", "") if privages == "" then privages_table = default_privages else privages_table = split(privages,",") end return p.generatePrivagesString(privages_table) end

return p