Module:Static/doc: Difference between revisions
m 11 revisions imported |
|||
| (7 intermediate revisions by 2 users not shown) | |||
| Line 10: | Line 10: | ||
function p.main() | function p.main() | ||
local static = require('Module:Static') | local static = require( 'Module:Static' ) | ||
static.x = (static.x or 0) + 1 | static.x = ( static.x or 0 ) + 1 | ||
return static.x | return static.x | ||
end | end | ||
| Line 21: | Line 21: | ||
== Dev spec == | == Dev spec == | ||
Because data stored through this module can be invoked by any modules used in the same page. To avoid being interfered with by other modules, a module '''MUST''' store data in their own namespace. For example in "Module:Example": | Because data stored through this module can be invoked by any modules used in the same page. To avoid being interfered with by other modules, a module '''MUST''' store data in their own namespace (a sub-table, see below), and '''NEVER''' modify data in other namespace. | ||
For example, in "Module:Example": | |||
<syntaxhighlight lang='lua'> | <syntaxhighlight lang='lua'> | ||
... | ... | ||
| Line 37: | Line 39: | ||
<!-- Template categories/interwikis here --> | <!-- Template categories/interwikis here --> | ||
[[Category:Meta modules]] | [[Category:Meta modules]] | ||
[[es:Módulo:Static]] | |||
[[fr:Module:Static]] | |||
[[pt:Módulo:Static]] | |||
[[ru:Модуль:Статические данные]] | |||
[[zh:Module:Static]] | [[zh:Module:Static]] | ||
}}</includeonly> | }}</includeonly> | ||
<noinclude> | <noinclude> | ||
<!-- Documentation categories/interwikis here --> | <!-- Documentation categories/interwikis here --> | ||
[[es:Módulo:Static/doc]] | |||
[[fr:Module:Static/doc]] | |||
[[pt:Módulo:Static/doc]] | |||
[[ru:Модуль:Статические данные/док]] | |||
[[zh:Module:Static/doc]] | [[zh:Module:Static/doc]] | ||
</noinclude> | </noinclude> | ||