A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://liquipedia.net/commons/Help:VariablesLua below:

Help:VariablesLua - Liquipedia Commons Wiki

Help:VariablesLua

From Liquipedia Commons Wiki

The VariablesLua extension is a direct interface to Extension:Variables. It supports all the functions that are supported by the main extension. This allows Scribunto Lua modules to exchange variables between each other and MediaWiki templates using the Extension:Variables parser functions.

Example[edit]
local p = {} -- p stands for package

function p.get(frame)
	local data = mw.ext.VariablesLua.var('variablename')
	-- data now holds the value of the variable "variablename"
	return data
end

function p.set(frame)
	mw.ext.VariablesLua.vardefine('variablename', 'variablevalue')
	-- The variable "variablename" now holds the value "variablevalue"
end

function p.setecho(frame)
	local data = mw.ext.VariablesLua.vardefineecho('variablename', 'variablevalue')
	-- The variable "variablename" now holds the value "variablevalue"
	-- data now has the value "variablevalue"
	return data
end

return p

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4