Preferred calling convention
editlocal m_languages = require("Module:languages")
local lang = m_languages.getByCode(frame.args[1], 1)
Here, we call getByCode
with the parameter name in the second parameter.
Old (obsolete) calling convention
editrequire("Module:languages/error")(lang, param, text)
Looks at a supposed language code passed through a template parameter and returns a helpful error message depending on whether the language code has a valid form (two or three lowercase basic Latin letters, two or three groups of three lowercase basic Latin letters separated by hyphens).
Add the parameter value in argument #1 and the parameter name in argument #2. For instance, if parameter 1
of the template is supposed to be a language code, this function can be called the following way:
local m_languages = require("Module:languages")
local lang = m_languages.getByCode(frame.args[1]) or require("Module:languages/error")(frame.args[1], 1)
If you would like the error message to say something other than "language code", place the phrase in argument #3.