Module:Utils/doc: Difference between revisions

ArrowHead294 (talk | contribs)
m Update documentation + further de-escaping
ArrowHead294 (talk | contribs)
mNo edit summary
Line 7: Line 7:
=== Functions ===
=== Functions ===
; <code>table_contains(tbl, x)</code>
; <code>table_contains(tbl, x)</code>
: Check if table contains x. This function is designed to be used by other modules only; it cannot be called with <code><nowiki>{{#invoke:}}</nowiki></code>.
: Check if table contains x. This function is designed to be used by other modules only; it cannot be called with <code>{{<nowiki />#invoke:}}</code>.


; <code>index_of(array, index)</code>
; <code>index_of(array, index)</code>
: Return the first index with the given value (or nil if not found). This function is designed to be used by other modules only; it cannot be called with <code><nowiki>{{#invoke:}}</nowiki></code>.
: Return the first index with the given value (or nil if not found). This function is designed to be used by other modules only; it cannot be called with <code>{{<nowiki />#invoke:}}</code>.


; <code>value_provided(s)</code>
; <code>value_provided(s)</code>
: Checks if <code>s</code> is a non-empty string. This function is designed to be used by other modules only; it cannot be called with <code><nowiki>{{#invoke:}}</nowiki></code>.
: Checks if <code>s</code> is a non-empty string. This function is designed to be used by other modules only; it cannot be called with <code>{{<nowiki />#invoke:}}</code>.


; <code>eval_num_arg(input, def_value)</code>
; <code>eval_num_arg(input, def_value)</code>
: Checks if <code>input</code> is a number; on error, use <code>def_value</code>. This function is designed to be used by other modules only; it cannot be called with <code><nowiki>{{#invoke:}}</nowiki></code>.
: Checks if <code>input</code> is a number; on error, use <code>def_value</code>. This function is designed to be used by other modules only; it cannot be called with <code>{{<nowiki />#invoke:}}</code>.


; <code>log(x, b)</code>
; <code>log(x, b)</code>
Line 31: Line 31:


; <code>is_prime(n)</code>
; <code>is_prime(n)</code>
: Returns <code>true</code> if the given integer <code>n</code> is a prime number. This function is designed to be used by other modules only; it cannot be called with <code><nowiki>{{#invoke:}}</nowiki></code>.
: Returns <code>true</code> if the given integer <code>n</code> is a prime number. This function is designed to be used by other modules only; it cannot be called with <code>{{<nowiki />#invoke:}}</code>.


; <code>prime_factorization(n)</code>
; <code>prime_factorization(n)</code>
Line 37: Line 37:


; <code>prime_factorization_raw(n)</code>
; <code>prime_factorization_raw(n)</code>
: Returns a table encoding the prime factorization of <code>n</code>. This function is designed to be used by other modules only; it cannot be called with <code><nowiki>{{#invoke:}}</nowiki></code>.
: Returns a table encoding the prime factorization of <code>n</code>. This function is designed to be used by other modules only; it cannot be called with <code>{{<nowiki />#invoke:}}</code>.


; <code>signum(x)</code>
; <code>signum(x)</code>
: Returns 1 for positive numbers, -1 for negative ones, 0 for zero and non-integer inputs. This function is designed to be used by other modules only; it cannot be called with <code><nowiki>{{#invoke:}}</nowiki></code>.
: Returns 1 for positive numbers, -1 for negative ones, 0 for zero and non-integer inputs. This function is designed to be used by other modules only; it cannot be called with <code>{{<nowiki />#invoke:}}</code>.


; <code>next_young_diagram(d)</code>
; <code>next_young_diagram(d)</code>
: Returns the next Young diagram of the same size; the first one is <code>[N]</code>, the last one is <code>[1, 1, ..., 1]</code>. After the last one, <code>nil</code> is returned. The input table is modified. This function is designed to be used by other modules only; it cannot be called with <code><nowiki>{{#invoke:}}</nowiki></code>.
: Returns the next Young diagram of the same size; the first one is <code>[N]</code>, the last one is <code>[1, 1, ..., 1]</code>. After the last one, <code>nil</code> is returned. The input table is modified. This function is designed to be used by other modules only; it cannot be called with <code>{{<nowiki />#invoke:}}</code>.
}}
}}