Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Rfx/doc
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Methods and properties === Once you have created a new <code>rfx</code> object, there are a number of methods and properties that you can use. They are all read-only. ; Properties * <code>type</code>: the type of the rfx. This is either "<code>rfa</code>" or "<code>rfb</code>". * <code>supports</code>: the number of supports in the RfX. <code>nil</code> if the supports could not be processed. * <code>opposes</code>: the number of opposes in the RfX. <code>nil</code> if the opposes could not be processed. * <code>neutrals</code>: the number of neutrals in the RfX. <code>nil</code> if the neutrals could not be processed. * <code>percent</code>: the support percentage. Calculated by <math>\frac{\text{supports}}{\text{supports} + \text{opposes}} \times 100</math> and rounded to the nearest integer. <code>nil</code> if it could not be processed. * <code>endTime</code>: the end time of the RfX. This is a string value taken from the RfX page. <code>nil</code> if it could not be found. * <code>user</code>: the username of the RfX candidate. <code>nil</code> if it could not be found. ; Methods Methods must be called with the colon syntax: <syntaxhighlight lang="lua"> local titleObject = exampleRfa:getTitleObject() </syntaxhighlight> * <code>getTitleObject()</code>: gets the title object for the RfX page. See the [[:mw:Extension:Scribunto/Lua reference manual#Title objects|reference manual]] for details on how to use title objects. * <code>getSupportUsers()</code>: gets an array containing the usernames that supported the RfX. If any usernames could not be processed, the text "Error parsing signature" is used instead, along with the text of the comment in question. N.b. this technique relies on the text of comment text being unique - if it is not unique then <code>dupesExist()</code> will treat the identical comments as duplicate votes. If the page content could not be parsed at all, this method returns <code>nil</code>. * <code>getOpposeUsers()</code>: gets an array containing the usernames that opposed the RfX. Functions similarly to <code>getSupportUsers()</code>. * <code>getNeutralUsers()</code>: gets an array containing the usernames that were neutral at the RfX. Functions similarly to <code>getSupportUsers()</code>. * <code>dupesExist()</code>: returns a boolean indicating whether there were any duplicate votes at the RfX. Returns <code>nil</code> if the vote tables couldn't be processed. * <code>getSecondsLeft()</code>: returns the number of seconds left before the RfX is due to close. Once it is due to close, shows zero. If the ending time cannot be found, returns <code>nil</code>. * <code>getTimeLeft()</code>: returns a string showing the time left before the RfX is due to close. The string is in the format "<code>x days, y hours</code>". * <code>getReport()</code>: returns a [[rev:https://www.mediawiki.org/wiki/Extension:Scribunto/Lua reference manual#URI object#URI object|URI object]] for X!'s RfA Analysis tool at Wikimedia Labs, preloaded with the RfX page. * <code>getStatus()</code>: returns a string showing the current status of the RfX. This can be "successful", "unsuccessful", "open", or "pending closure". Returns <code>nil</code> if the status could not be determined. You can compare <code>rfx</code> objects with the <code>==</code> operator. This will return true only if the two objects point to the same page. <code>tostring( rfx )</code> will return <code>prefixedTitle</code> from the RfX page's title object (see the [[:mw:Extension:Scribunto/Lua reference manual#Title objects#Title objects|reference manual]]).
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)