Modul:CallAssert/doc
Ini adalah halaman dokumentasi untuk Modul:CallAssert
TemplateStyles' src
attribute must not be empty.
This Lua module is used in system messages. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid major disruption, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them. |
This metamodule provides function callAssert, which simplifies error checking by throwing an error if a given function returns nil or false. This is similar to the built-in function assert, but unlike it, callAssert itself calls the function, whose return value is to be checked. This allows it to include the function name and argument values in the error message.
Usage
beccè'local callAssert = require('Module:CallAssert') local result1, result2, etc = callAssert(func,
- REDIRECT Template:Apostrophe
TemplateStyles' src
attribute must not be empty.
This page is a redirect. The following categories are used to track and monitor this redirect:
|
funcName
- REDIRECT Template:Apostrophe
TemplateStyles' src
attribute must not be empty.
This page is a redirect. The following categories are used to track and monitor this redirect:
|
, ...)
callAssert
calls func(...)
and checks if the first returned value evaluates to true. If it does, then it returns all the returned values. If not, it throws an error with a message in the form
- REDIRECT Template:Apostrophe
TemplateStyles'
src
attribute must not be empty.
This page is a redirect. The following categories are used to track and monitor this redirect:
- From a page move: This is a redirect from a page that has been moved (renamed). This page was kept as a redirect to avoid breaking links, both internal and external, that may have been made to the old page name.
When appropriate, protection levels are automatically sensed, described and categorized.
funcName(argument_values) failed'
.