此頁面為 Module:Variables 的說明文件
This module provides a Lua interface for the parser functions provided by Extension:Variables.
Usage[]
Function names are identical to the parser function names.
Variables.vardefineecho[]
Returns the value as it was stored (as a string). Should only be used to verify the stored value, not for inline declarations.
Differences[]
- Returns
nil
instead of empty strings (usep.varexists()
to check for variables holding an empty string). varexists()
returns a boolean instead of1
ornil
.
Tests[]
All tests passed.
Name | Expected | Actual | |
---|---|---|---|
test_var_defined | |||
test_var_defined_empty | |||
test_var_defined_empty_default | |||
test_var_not_defined | |||
test_var_not_defined_default | |||
test_vardefine_boolean | |||
test_vardefine_function_throws | |||
test_vardefine_nil | |||
test_vardefine_number | |||
test_vardefine_string | |||
test_vardefine_table_throws | |||
test_vardefineecho_boolean | |||
test_vardefineecho_function_throws | |||
test_vardefineecho_nil | |||
test_vardefineecho_number | |||
test_vardefineecho_returns | |||
test_vardefineecho_string | |||
test_vardefineecho_table_throws | |||
test_varexists_false | |||
test_varexists_true |