User:Lakelimbo/Sandbox

Modules

I made a very basic module to show some possibilities with Scribunto/Lua. This module has 3 built-in functions:

List divisors of a number

Very simple concept, it will simply list the divisors of a number and list them. If the divisor is 0, a special message will appear.


The divisors for 10 are:

  • 1
  • 2
  • 5
  • 10
  • The divisors for 25 are:

    • 1
    • 5
    • 25
    • The divisors for 3 are:

      • 1
      • 3
      • The divisors for 18 are:

        • 1
        • 2
        • 3
        • 6
        • 9
        • 18
        • The divisors for 75 are:

          • 1
          • 3
          • 5
          • 15
          • 25
          • 75
          • 0 has no divisors!


            {{#invoke:test|divisor|10}}
            {{#invoke:test|divisor|25}}
            {{#invoke:test|divisor|3}}
            {{#invoke:test|divisor|18}}
            {{#invoke:test|divisor|75}}
            {{#invoke:test|divisor|0}}
            

            Colors

            Another function will get a color, and you can get a shade of it too. For demonstration purposes, I only added Bulba's base stat colors:


            efcc18 efcc18 e46cca


            {{#invoke:test|colors|attack}}
            {{#invoke:test|colors|color=attack|dark}}
            {{#invoke:test|colors|speed|shade=light}}
            

            There is also another function there that will take those colors and list them all:


            defense colors:

            • light: f09a65
            • dark: 97410c
            • regular: e86412
            • spattack colors:

              • light: 66d8f6
              • dark: 0d7f9d
              • regular: 14c3f1
              • spdefense colors:

                • light: 899eea
                • dark: 304591
                • regular: 4a6adf
                • speed colors:

                  • light: e46cca
                  • dark: 8b1370
                  • regular: d51dad
                  • hp colors:

                    • light: 9ee865
                    • dark: 448f0c
                    • regular: 69dc12
                    • attack colors:

                      • light: f5de69
                      • dark: 9b8510
                      • regular: efcc18

                      • {{#invoke:test|listcolors}}