Module:Utils/doc: Difference between revisions

Clarify on eval_num_arg
m Clarify +1 and consistency
Line 19: Line 19:


; <code>table_contains(tbl, value, compare_func)</code> *
; <code>table_contains(tbl, value, compare_func)</code> *
: Check whether table contains <code>value</code>. Passing in <code>compare_func</code> is optional; if <code>value</code> is a table and <code>tbl</code> a table of tables, pass in a comparison function <code>compare_func</code>, which returns <code>true</code> if <code>value</code> and an element in <code>tbl</code> have the same value.{{clarify}}
: Checks whether table <code>tbl</code> contains <code>value</code>. Passing in <code>compare_func</code> is optional; if <code>value</code> is a table and <code>tbl</code> a table of tables, pass in a comparison function <code>compare_func</code>, which returns <code>true</code> if <code>value</code> and an element in <code>tbl</code> have the same value.{{clarify}}


; <code>index_of(array, value, compare_func)</code> *
; <code>index_of(array, value, compare_func)</code> *
: Return the first index with the given <code>value</code> (or nil if not found). Passing in <code>compare_func</code> is optional; if <code>value</code> is a table and <code>tbl</code> a table of tables, pass in a comparison function <code>compare_func</code>, which returns <code>true</code> if <code>value</code> and an element in <code>tbl</code> have the same value.{{clarify}}
: Returns the first index with the given <code>value</code> (or nil if not found). Passing in <code>compare_func</code> is optional; if <code>value</code> is a table and <code>tbl</code> a table of tables, pass in a comparison function <code>compare_func</code>, which returns <code>true</code> if <code>value</code> and an element in <code>tbl</code> have the same value.{{clarify}}


; <code>value_provided(s)</code> *
; <code>value_provided(s)</code> *
Line 28: Line 28:


; <code>eval_num_arg(input, def_value)</code> *
; <code>eval_num_arg(input, def_value)</code> *
: Evaluate <code>input</code> as a number, fraction notation supported; on error, use <code>def_value</code>.
: Evaluates <code>input</code> as a number, fraction notation supported but not other expressions; uses <code>def_value</code> on error.


; <code>log(x, b)</code>
; <code>log(x, b)</code>