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:Sandbox/Squc/Roman/doc
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!
This module converts [[Roman numerals]] to [[decimal]] form, and rejects invalid ones. It can be used normally, or through another module. This is still under construction, check back in a few days! This module is intended to run through a template, which is still under construction. To convert Roman numerals to decimal form, use {{mlx|{{PAGENAME}}|todecimal|MMXIII}}, which outputs {{#invoke:Sandbox/Squc/Roman|todecimal|MMXIII}}. If the Roman numeral is invalid, it will throw an error. If JavaScript is enabled, you can click the '''Script error''' link, and the first sentence should show the cause of the error. The final value will still be given in brackets after the error messages. To force no errors, use {{mlx|{{PAGENAME}}|todecimal|mode=1|MMXIII}}. To output errors directly into the text, use {{mlx|{{PAGENAME}}|todecimal|mode=2|disp=Decimal number: \n, Errors \e, Time \t|MMXIII}}. To use this through another module, use something like this: <syntaxhighlight lang="lua"> local roman = require( "Module:Sandbox/Squc/Roman" ) local romannum = "MMXIII" local value = roman.todecimald( romannum ) </syntaxhighlight> {| class="wikitable" border="1" |+ Error demonstration ! function !! No errors !! Warnings !! Invalid !! Errors |- ! Example !! MMXIII !! XXXXX !! XCC !! ABC |- |todecimal||{{#invoke:Sandbox/Squc/Roman|todecimal|MMXIII}}||{{#invoke:Sandbox/Squc/Roman|todecimal|XXXXX}}||{{#invoke:Sandbox/Squc/Roman|todecimal|XCC}}||{{#invoke:Sandbox/Squc/Roman|todecimal|ABC}} |- |todecimal|mode=1||{{#invoke:Sandbox/Squc/Roman|todecimal|mode=1|MMXIII}}||{{#invoke:Sandbox/Squc/Roman|todecimal|mode=1|XXXXX}}||{{#invoke:Sandbox/Squc/Roman|todecimal|mode=1|XCC}}||{{#invoke:Sandbox/Squc/Roman|todecimal|mode=1|ABC}} |- |todecimal|mode=2|disp=Decimal ...||{{#invoke:Sandbox/Squc/Roman|todecimal|mode=2|disp=Decimal number: \n, Errors \e, Time \t|MMXIII}}||{{#invoke:Sandbox/Squc/Roman|todecimal|mode=2|disp=Decimal number: \n, Errors \e, Time \t|XXXXX}}||{{#invoke:Sandbox/Squc/Roman|todecimal|mode=2|disp=Decimal number: \n, Errors \e, Time \t|XCC}}||{{#invoke:Sandbox/Squc/Roman|todecimal|mode=2|disp=Decimal number: \n, Errors \e, Time \t|ABC}} |- |todecimald||colspan=4|Intended for use only from other modules. See below for more details. |} Errors will be combined, e.g. "XXXXXXCC" gives: {{#invoke:Sandbox/Squc/Roman|todecimal|mode=2|disp=Decimal number: \n, Errors \e, Time \t|XXXXXXCC}} or with mode=2|disp=0 (default): {{#invoke:Sandbox/Squc/Roman|todecimal|mode=2|disp=0|XXXXXXCC}} ;todecimald The function todecimald (direct) is only intended for use in other modules. The output will be in the form (comma-separated list): <code>Decimal, Error message, Time taken</code> The decimal will be a number, it will be the converted number if there are no errors or if it is a warning (it is invalid but still can be converted), it will be -1 if there is an error (cannot be converted). The error message is a string and will always exist, it will be <code>""</code> if no error is found.
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)
Templates used on this page:
Template:Mlx
(
edit
)
Module:Sandbox/Squc/Roman
(
edit
)