सामग्री पर जाएँ

साँचा:Evalx/विव

विकिपुस्तक से

This template evaluates an expression sequence using Module:Wikilisp. Pass the expression sequence as the first unnamed template parameter; all parameters to the template are also passed to the the module. For example,

{{evalx|(get-substring (get-arg 2) 2 3)|abcd}}

would expand to

bc

A different module, to use instead of Module:Wikilisp, may be specified by non-blank template parameter test-eval.

When Module:Wikilisp is #invoked directly, rather than through an intermediary template such as {{evalx}}, the module point of entry is Lua function rep, and the invocation parameters are accessible through Wikilisp functions get-arg and get-arg-expr. However, the intermediary template cannot explicitly pass its arbitrary template parameters to the invocation since it doesn't know their names in advance. To compensate, an alternative point of entry is provided through Lua function trep, that feeds get-arg and get-arg-expr the parameters to the intermediary template instead of the parameters to #invoke.