Module:Member tags

local utils = require('Module:Utils')

local p = {}

p.member_tag_descriptions = { CanYield = "This function can yield the script it is used in."; CustomLuaState = "This member uses the Lua C API directly."; Deprecated = "This member will be phased out and should be avoided while it is still available."; NotBrowsable = "This member is not visible in documentation for end-users."; NotScriptable = "This member cannot be accessed by Lua code."; backend = "This member can only be used in game servers and solo games."; NotReplicated = "This member is not replicated across the network boundary."; Yields = "This function can yield the script it is used in."; -- Properties Hidden = "This property is not shown in the object browser and properties window."; ReadOnly = "This property is capable of being read but not written."; writeonly = "This property is capable of being written but not read."; -- Callbacks noyield = "This callback is asynchronous."; -- Security contexts PluginSecurity = "This member can be used from studio plugins, or the command bar in studio."; RobloxPlaceSecurity = "This member can be used from scripts in ROBLOX-authored places."; RobloxScriptSecurity = "This member can only be used from CoreScripts."; LocalUserSecurity = "This member can be used from the command bar in studio."; WritePlayerSecurity = "This member can only be used while receiving data via replication."; RobloxSecurity = "This member can only be used from the COM API or the web service API."; ['ScriptWriteRestricted: [NotAccessibleSecurity]'] = "This member cannot be accessed by any script, and can only be edited in the properties menu."; ['ScriptWriteRestricted: [PluginSecurity]'] = "This member can only be read and written to from the command bar and plugins."; -- Custom tags ['yield'] = "This function can yield the script it is used in."; removed = "This member has been removed. Attempting to use it will cause an error.", disabled = "This member is not yet enabled. Attempting to use it will cause an error." }

-- Old tag names, still used on some pages. p.member_tag_descriptions.deprecated = p.member_tag_descriptions.Deprecated p.member_tag_descriptions.notbrowsable = p.member_tag_descriptions.NotBrowsable p.member_tag_descriptions.hidden = p.member_tag_descriptions.Hidden p.member_tag_descriptions.readonly = p.member_tag_descriptions.ReadOnly

function p._make_tag(args) local tag_name = args.name local tag_description = p.member_tag_descriptions[tag_name] if not tag_description then return error("Unknown member tag: " .. tag_name) end local tag = mw.html.create("span") :addClass("member-tag") :css("color", "gray") :wikitext(tag_name) if tag_description ~= "" then tag :addClass("explain") :attr("title", tag_description) end return tostring(tag) end p.make_tag = utils.make_wrapper_function(p._make_tag)

function p._make_heading_tag(args) local tag_name = args.name local tag_description = p.member_tag_descriptions[tag_name] if not tag_description then error("Unknown member tag: " .. tag_name) end local tag = mw.html.create("span") :addClass("member-tag") :css("color", "gray") :wikitext("[" .. tag_name .. "]") if tag_description ~= "" then tag :addClass("explain") :attr("title", tag_description) end return tostring(tag) end p.make_heading_tag = utils.make_wrapper_function(p._make_heading_tag)

return p