Editing Module:EcoVersionData/doc
From Eco - English Wiki
Your changes will be displayed to readers once an authorized user accepts them. (help)
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
{{ | == Documentation == | ||
{{Data file module}} | |||
== Usage == | == Usage == | ||
To use the '''ecoVersion''' string in wikitext, see [[Template: | To use the '''ecoVersion''' string in wikitext, see [[Template:Eco version]]. | ||
For usage through Lua, see the example code below. | For usage through Lua, see the example code below. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- Load data only once per page. (Do no use require()) | -- Load data only once per page. (Do no use require()) | ||
local VersionData = mw.loadData("Module: | local VersionData = mw.loadData("Module:EcoVersion") | ||
-- Assert that some data was received, otherwise throw an error. | -- Assert that some data was received, otherwise throw an error. | ||
assert(VersionData.eco, "Failed to load data from Module: | assert(VersionData.eco, "Failed to load data from Module:EcoVersion!") | ||
-- You may then use data from this module in your script. | -- You may then use data from this module in your script. |