Module:Static/doc: Difference between revisions
Jump to navigation
Jump to search
Add docs |
mNo edit summary |
||
Line 21: | Line 21: | ||
<includeonly>{{sandbox other|| | <includeonly>{{sandbox other|| | ||
<!-- Template categories/interwikis here --> | <!-- Template categories/interwikis here --> | ||
[[Category: | [[Category:Meta modules]] | ||
[[zh:Module:Static]] | |||
}}</includeonly> | }}</includeonly> | ||
<noinclude> | <noinclude> | ||
<!-- Documentation categories/interwikis here --> | <!-- Documentation categories/interwikis here --> | ||
[[zh:Module:Static/doc]] | |||
</noinclude> | </noinclude> |
Revision as of 03:37, 5 April 2024
[refresh]
This is the documentation page. It is transcluded into Module:Static. See Template:Documentation for more information.Usage
This module returns a table that can store data that persists in between multiple {{#Invoke:}}
calls.
Example:
local p = {}
function p.main()
local static = require('Module:Static')
static.x = (static.x or 0) + 1
return static.x
end
return p
If the above code sample was stored in Module:foo
and then {{#Invoke:foo|main}} {{#Invoke:foo|main}}
would result in 1 2
.