This module provides a function which adds fallback functionalities to a given table args according to the fallback sequence given in arg_aliases. Note that this module currently only supports indexing, i.e. __index
.
{ [key] = { fallback1, fallback2... } }
.
The following snippet adds template parameter aliases to a metatable obtained from .
function p.main(frame) local args = makeFallback(getArgs(frame),) -- Try calling this template with |foo=42. return (args["foo_bar"] or "nothing here!")end
return p
The following snippet shows basic usage of indexing fallback.
makeFallback(table,)
return table["foo_bar"]
The following snippet creates a fallback list with all fallback names aliasing back to the main name.